Skip to content

Commit

Permalink
Use dependencies and dist already created at step 1
Browse files Browse the repository at this point in the history
They are independent from the architecture.
  • Loading branch information
greg0ire committed Jul 4, 2024
1 parent a5e2658 commit 26e1d6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
name: dist
path: dist

- name: Upload node_modules
uses: actions/upload-artifact@v4
with:
name: node_modules
path: node_modules

docker:
name: Build Docker Image and publish to Github Artifact Registry
needs: build
Expand All @@ -42,12 +48,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: ↙️ Download build artifact
- name: ↙️ Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: ↙️ Download node_modules
uses: actions/download-artifact@v4
with:
name: node_modules
path: node_modules

- uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
Expand All @@ -63,11 +75,6 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Unconfigure npm proxy
run: |
npm config rm proxy
npm config rm https-proxy
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
Expand Down
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ EXPOSE 3000

USER node

COPY --chown=node:node package.json /home/node/app/package.json
COPY --chown=node:node yarn.lock /home/node/app/yarn.lock
COPY --chown=node:node dist /home/node/app/dist

RUN yarn install --network-timeout 1000000
COPY --chown=node:node node_modules /home/node/app/node_modules

CMD ["node", "dist/src/index.js"]

0 comments on commit 26e1d6e

Please sign in to comment.