Skip to content
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

Two stage docker build #18

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Two stage docker build #18

merged 2 commits into from
Jan 6, 2025

Conversation

mdellabitta
Copy link
Contributor

@mdellabitta mdellabitta commented Jan 6, 2025

Important

Introduce a two-stage Docker build process to separate build and production stages, optimizing the Docker image creation.

  • Dockerfile:
    • Introduces a two-stage build process with thumbnail-api-builder and thumbnail-api-prod stages.
    • thumbnail-api-builder stage compiles the application using npm install and npm run build.
    • thumbnail-api-prod stage installs production dependencies and copies build artifacts from the builder stage.
  • package.json:
    • Modifies clean script to remove thumbnail-api.zip removal.

This description was created by Ellipsis for 45d219c. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 45d219c in 28 seconds

More details
  • Looked at 50 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. Dockerfile:23
  • Draft comment:
    Consider removing --omit=optional unless there is a specific reason to exclude optional dependencies.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The Dockerfile uses npm install --omit=dev --omit=optional --ignore-scripts in the production stage, which is correct for excluding dev dependencies. However, the --omit=optional flag might not be necessary unless there is a specific reason to exclude optional dependencies.
2. Dockerfile:19
  • Draft comment:
    Move the chown command before copying files from the builder stage to ensure correct permissions.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is about file permissions, which is a real security concern. Moving chown before the COPY would ensure the copied files have correct permissions immediately. However, the current location also works - it changes permissions of all files in one go, including the copied ones. Both approaches are valid, and the current approach is not incorrect.
    The current approach might actually be more efficient since it does all chown operations in one layer. Moving it earlier would create an extra layer and potentially increase image size.
    While the comment suggests a valid alternative, the current implementation is not wrong and might even be better for image size optimization.
    The comment should be deleted because it suggests a change that isn't clearly better than the current implementation, and the current code is not incorrect.

Workflow ID: wflow_pjgS6PfKLNzmD7VQ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

sonarqubecloud bot commented Jan 6, 2025

@mdellabitta mdellabitta merged commit 7d66a66 into main Jan 6, 2025
5 checks passed
@mdellabitta mdellabitta deleted the two-stage-docker-build branch January 6, 2025 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant