-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adaper mulit domain and build docker
- Loading branch information
Showing
8 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build docker image | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
if: github.repository == 'crustio/ethda-home' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.4.0' | ||
|
||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- name: Run install | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build for production | ||
run: pnpm build | ||
|
||
- name: Build docker and publish | ||
run: | | ||
docker build -t crustio/ethda-home:latest . | ||
docker login -u ${{ secrets.DOCKER_HUB_USER_NAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
docker push crustio/ethda-home:latest | ||
- name: Update docker compose | ||
run: ${{ secrets.RUN_CMD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:20-alpine as runner | ||
|
||
FROM runner | ||
RUN npm install serve -g | ||
WORKDIR /app | ||
|
||
COPY /out . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD serve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useEffect } from 'react' | ||
|
||
export const DomainRef = { | ||
value: 'ethda.io', | ||
} | ||
|
||
const supportDomain = ['ethda.io', 'ethda.xyz', 'ethda.com'] | ||
|
||
export const getAvilableDomain = () => { | ||
if (location.hostname == 'localhost') return supportDomain[0] | ||
if (location.hostname.match(/^\d+\.\d+\.\d+\.\d+$/)?.length == 1) return supportDomain[0] | ||
const domains = location.hostname.split('.') | ||
let domain = domains.slice(-2).join('.') | ||
if (domains[1] == 'ipns') { | ||
domain = domains[0].replaceAll('-', '.') | ||
} | ||
if (supportDomain.includes(domain)) { | ||
return location.hostname | ||
} | ||
return supportDomain[0] | ||
} | ||
export function useConfigDomain() { | ||
useEffect(() => { | ||
DomainRef.value = getAvilableDomain() | ||
}, []) | ||
} |