Skip to content

Commit

Permalink
chore: skip npm install in docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 6, 2023
1 parent b29c569 commit ff28a28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ docs
.nyc_output
.coverage
test
node_modules
8 changes: 6 additions & 2 deletions .github/workflows/dockerbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
org.opencontainers.image.authors=Daniel Lando <daniel.sorridi@gmail.com>
org.opencontainers.image.url=https://github.com/moscajs/aedes-cli
maintainer=robertsLando
- name: Install dependencies (to skip install in docker build)
run: |
npm install --omit=dev
- name: build+push
timeout-minutes: 30
Expand All @@ -46,8 +50,8 @@ jobs:
platforms: linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7
context: .
file: docker/Dockerfile
# cache-from: type=gha
# cache-to: type=gha,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ COPY . .
# set production env, npm install will not install devDependencies
ENV NODE_ENV=production

RUN npm install --omit=dev
# if node_modules does not exist, run it, otherwise skip
RUN test -d node_modules || npm install --omit=dev

RUN chmod 755 /usr/src/app/bin/aedes

EXPOSE 1883 3000 8883 4000
Expand Down

0 comments on commit ff28a28

Please sign in to comment.