diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..3c3629e647 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index ce1e3034b7..0e1ec62735 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,51 +1,46 @@ name: docker - on: + pull_request: {} push: branches: - - 'master-backup' + - 'master' + tags: + - 'v*' jobs: - docker: + build-docker-image: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 -# - -# name: Set up QEMU -# uses: docker/setup-qemu-action@v1 -# - -# name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v1 - - name: Install - run: yarn install - - name: Build - run: yarn run vue-cli-service build - - name: Login to DockerHub - uses: docker/login-action@v1 + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + if: (github.event_name != 'pull_request') with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4 with: - # list of Docker images to use as base name for tags - images: | - yaoling/wallet - # generate Docker tags based on the following events/attributes + images: ghcr.io/${{ github.repository }} tags: | - type=sha - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} + type=raw,value=latest + type=semver,pattern=v{{version}} + - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} + cache-from: type=gha + cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/mainnet-deploy.yaml.disabled b/.github/workflows/mainnet-deploy.yaml.disabled deleted file mode 100644 index 0b69f65c88..0000000000 --- a/.github/workflows/mainnet-deploy.yaml.disabled +++ /dev/null @@ -1,28 +0,0 @@ - -name: Deploy to ping.pub - -on: - push: - branches: [ master2 ] - # pull_request: - # branches: [ master ] - -jobs: - deploy: - name: Ping deploy - runs-on: mainnet - steps: - - name: Environment - run: export NODE_OPTIONS="--max_old_space_size=4096" - - - name: Git Checkout Latest - uses: actions/checkout@v3 - - - name: Install - run: yarn install --ignore-engines - - - name: Build - run: yarn build - - - name: Deploy - run: cp -rf ./dist/* /var/www/html/ \ No newline at end of file diff --git a/.github/workflows/testnet-deploy.yaml b/.github/workflows/testnet-deploy.yaml deleted file mode 100644 index 55391d0122..0000000000 --- a/.github/workflows/testnet-deploy.yaml +++ /dev/null @@ -1,27 +0,0 @@ - -name: Testnet Deploy - -on: - push: - branches: [ testnet ] - pull_request: - branches: [ testnet ] - -jobs: - deploy: - name: Ping deploy - runs-on: testnet - steps: - - name: print - run: echo ${GITHUB_REF#refs/heads/} - - name: Git Checkout Latest - uses: actions/checkout@v2 - - - name: Install - run: yarn install - - - name: Build - run: yarn run vue-cli-service build - - - name: Deploy - run: cp -rf ./dist/* /var/www/html/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..b0278aedee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:23-alpine AS build + +WORKDIR /app + +ENV YARN_CACHE_FOLDER=/root/.yarn +RUN mkdir -p $YARN_CACHE_FOLDER + +COPY . /app + +RUN --mount=type=cache,mode=0777,target=/root/.yarn yarn install +RUN --mount=type=cache,mode=0777,target=/root/.yarn yarn build + +## Final image +FROM node:23-alpine + +RUN yarn global add serve + +COPY --from=build /app/dist /root/dist + +EXPOSE 3000 + +ENTRYPOINT [ "serve", "-s", "/root/dist", "-l", "tcp://0.0.0.0:3000" ]