-
Notifications
You must be signed in to change notification settings - Fork 3.5k
ajuste docker #1686
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
base: main
Are you sure you want to change the base?
ajuste docker #1686
Conversation
Reviewer's GuideThis PR refactors the Docker build process by introducing a reusable base stage, adding a dedicated development stage in the Dockerfile with its own entrypoint, and updating the production and development compose files to build locally (using stage targeting), while also refining the Postgres service configuration and volume mounts. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @borgesthiago - I've reviewed your changes - here's some feedback:
- The dev stage in the Dockerfile re-installs dependencies and repeats apk installs—consider basing it on the builder stage (FROM builder AS dev) to reuse the build cache and avoid duplication.
- In docker-compose.dev.yaml, mounting
./:/evolution
will overwrite your container’s node_modules—add a dedicated volume for node_modules (e.g./evolution/node_modules
) or adjust the bind mount to prevent losing installed deps. - Hardcoding Postgres credentials in docker-compose.yaml can lead to inconsistencies—extract these into an .env file or use environment variables via
env_file
to manage credentials across environments.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The dev stage in the Dockerfile re-installs dependencies and repeats apk installs—consider basing it on the builder stage (FROM builder AS dev) to reuse the build cache and avoid duplication.
- In docker-compose.dev.yaml, mounting `./:/evolution` will overwrite your container’s node_modules—add a dedicated volume for node_modules (e.g. `/evolution/node_modules`) or adjust the bind mount to prevent losing installed deps.
- Hardcoding Postgres credentials in docker-compose.yaml can lead to inconsistencies—extract these into an .env file or use environment variables via `env_file` to manage credentials across environments.
## Individual Comments
### Comment 1
<location> `Dockerfile:43` </location>
<code_context>
+
+RUN npm install
+
+ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ]
+
FROM node:20-alpine AS final
</code_context>
<issue_to_address>
ENTRYPOINT with bash -c can complicate signal handling.
This approach may prevent signals like SIGTERM from reaching the Node.js process, impacting graceful shutdown. Consider running the Node.js process directly for better signal handling.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ]
=======
ENTRYPOINT ["npm", "run", "dev:server"]
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
||
RUN npm install | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ] |
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.
suggestion (bug_risk): ENTRYPOINT with bash -c can complicate signal handling.
This approach may prevent signals like SIGTERM from reaching the Node.js process, impacting graceful shutdown. Consider running the Node.js process directly for better signal handling.
ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ] | |
ENTRYPOINT ["npm", "run", "dev:server"] |
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.
congratulations, it was well organized
Summary by Sourcery
Consolidate Dockerfile stages with a shared base image, introduce a dedicated development stage, and align docker-compose configurations to build from the correct targets and update environment settings.
New Features:
dev
stage in the Dockerfile for local development with live code mounting andnpm run dev:server
entrypoint.Enhancements:
base
stage and reorganize builder stage accordingly.Deployment:
docker-compose.yaml
to build the API service from the final target instead of using a prebuilt image.docker-compose.dev.yaml
to build from thedev
stage and mount the project directory for live reload.