-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(api): Optimize dockerfile - WIP #5454
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for novu-design ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WORKDIR /usr/src/app/apps/api | ||
CMD [ "pm2-runtime","start", "dist/main.js" ] | ||
CMD [ "dump-init", "node", "dist/main.js" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this one be dumb-init
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed some best practices and found out about https://github.com/Yelp/dumb-init. Maybe we need it, maybe not. We will review it as soon as this is more testable.
Note that my goal is to remove PM2. I don't think it adds value at this point.
COPY --chown=1000:1000 ./meta . | ||
COPY --chown=1000:1000 ./deps . | ||
COPY --chown=1000:1000 ./pkg . | ||
COPY --chown=1000:1000 ./meta ./deps ./pkg ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interim stage, I think we don't have to unite these layers because we won't use dev, it's important to decrease dev_base and prod. Docker caches each line in the Dockerfile, and that the output of one line is the input of the next. So if a line generates new output all subsequent caches are invalidated. In this case we lost an opportunity to use cache even if only last folder will be changed we copy all of them.
@@ -1,11 +1,10 @@ | |||
FROM node:20-alpine3.19 as dev_base | |||
RUN apk add g++ make py3-pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can exclude cache because we use dev_base in the final step RUN apk add --no-cache g++ make py3-pip
What changed? Why was the change needed?
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer