Skip to content

Commit

Permalink
fix(Dockerfile): use npm for starting the application
Browse files Browse the repository at this point in the history
When running the application with npm, the environment variable
NODE_ENV is set to production and npm_package_version is set to the
version in package.json. This is not the case when running simply with
node. This commit fixes this issue and now in the docker image and
in docker compose we use `npm run start:prod`.
  • Loading branch information
relu91 committed May 24, 2023
1 parent eff5f65 commit 9503bdf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ COPY --from=build /home/node/app/migrations ./migrations
COPY --from=build /home/node/app/static ./static

EXPOSE 3000
ENTRYPOINT ["node", "dist/src/main.js" ]
ENTRYPOINT ["npm", "run", "start:prod" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
image: vaimee/zion:latest
depends_on:
- database
entrypoint: ['sh', '-c','npm run db:migrate:latest && node dist/src/main.js']
entrypoint: ['sh', '-c','npm run db:migrate:latest && npm run start:prod']
ports:
- ${ZION_SERVER_PORT}:${ZION_SERVER_PORT}
container_name: zion
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
build: .
depends_on:
- database
entrypoint: ['sh', '-c','npm run db:migrate:latest && node dist/src/main.js']
entrypoint: ['sh', '-c','npm run db:migrate:latest && npm run start:prod']
ports:
- ${ZION_SERVER_PORT}:${ZION_SERVER_PORT}
container_name: zion
Expand Down

0 comments on commit 9503bdf

Please sign in to comment.