diff --git a/.github/workflows/docker-base-image.yml b/.github/workflows/docker-base-image.yml new file mode 100644 index 0000000..3d2486f --- /dev/null +++ b/.github/workflows/docker-base-image.yml @@ -0,0 +1,21 @@ +name: Build Docker image + +on: + push: + branches-ignore: + - master + pull_request: + +jobs: + build-base: + # Permissions for GITHUB_TOKEN + permissions: + contents: read # To check out repo + packages: read # To read NPM registry + + uses: wwwallet/wallet-ecosystem/.github/workflows/docker-build-push.yml@master + secrets: inherit + with: + image-tag: ghcr.io/wwwallet/wallet-enterprise:base + docker-push: false + dockerfile-path: ./base.Dockerfile \ No newline at end of file diff --git a/.github/workflows/docker-base-push.yml b/.github/workflows/docker-base-push.yml new file mode 100644 index 0000000..964fc40 --- /dev/null +++ b/.github/workflows/docker-base-push.yml @@ -0,0 +1,22 @@ +name: Push Docker image +on: + push: + tags: + - v0.* + - v1.* + - v2.* + + +jobs: + push-base: + # Permissions for GITHUB_TOKEN + permissions: + contents: read # To check out repo + packages: write # To read NPM registry + + uses: wwwallet/wallet-ecosystem/.github/workflows/docker-build-push.yml@master + secrets: inherit + with: + image-tag: ghcr.io/wwwallet/wallet-enterprise:base-${{ github.ref_name }} + docker-push: true + dockerfile-path: ./base.Dockerfile \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0ce3991..6f54875 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,6 +15,8 @@ jobs: packages: read # To read NPM registry uses: wwwallet/wallet-ecosystem/.github/workflows/docker-build-push.yml@master + secrets: inherit with: image-tag: ghcr.io/wwwallet/wallet-enterprise:latest docker-push: false + dockerfile-path: ./Dockerfile diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index af6d747..6485d9a 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -1,9 +1,11 @@ -name: Build and push Docker image - +name: Push Docker image on: push: - branches: - - master + tags: + - v0.* + - v1.* + - v2.* + jobs: build: @@ -14,6 +16,8 @@ jobs: packages: write # To read NPM registry and push Docker image uses: wwwallet/wallet-ecosystem/.github/workflows/docker-build-push.yml@master + secrets: inherit with: - image-tag: ghcr.io/wwwallet/wallet-enterprise:latest + image-tag: ghcr.io/wwwallet/wallet-enterprise:${{ github.ref_name }} docker-push: true + dockerfile-path: ./Dockerfile diff --git a/Dockerfile b/Dockerfile index 917e99f..a248b25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ COPY --from=builder /home/node/app/views ./views RUN --mount=type=secret,id=npmrc,required=true,target=./.npmrc,uid=1000 \ - yarn install --production + yarn cache clean && yarn install --production ENV NODE_ENV production EXPOSE 8003 diff --git a/base.Dockerfile b/base.Dockerfile new file mode 100644 index 0000000..c83186b --- /dev/null +++ b/base.Dockerfile @@ -0,0 +1,5 @@ +FROM node:16-bullseye-slim + +WORKDIR /app + +COPY . . \ No newline at end of file