Skip to content

Cache and volumes documentation improvements #20450

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

Closed
wants to merge 1 commit into from

Conversation

Luan1Schons
Copy link

As per the following PR "#20449" explaining that installing dependencies within the Dockerfile can be rolled back across volumes in development environments, it is interesting that you are also warned about dependency managers.

Description

For production environments, the current example is perfect. However, in development environments, we could have a new section explaining that using volumes would be sufficient instead of copying the content again with "COPY . .". Additionally, it is not necessary to run "npm run build" just to cache the layer, as this is not advantageous in development.

It is also recommended not to run package managers like npm, Composer, Maven, pip, etc., inside the image. Leave the installation to the CMD or ENTRYPOINT. This is important to ensure that the shared volume in development does not overwrite the files installed by the package manager.

FROM node
WORKDIR /app
COPY . .          # Copy over all files in the current directory
RUN pip install -r requeriments.txt   # Install dependencies
RUN python -m flask # RUN Flask

Reviews

  • Technical review
  • Editorial review
  • Product review

As per the following PR "docker#20449" explaining that installing dependencies within the Dockerfile can be rolled back across volumes in development environments, it is interesting that you are also warned about dependency managers.
@github-actions github-actions bot added the area/build Relates to Dockerfiles or docker build command label Jul 21, 2024
Copy link

netlify bot commented Jul 21, 2024

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 5b022d9
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/669d3b6c96b66b0008d6e605
😎 Deploy Preview https://deploy-preview-20450--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Luan1Schons Luan1Schons changed the title Update _index.md Cache and volumes documentation improvements Jul 21, 2024
@WillRy
Copy link

WillRy commented Jul 21, 2024

This observation is important, when I was studying the documentation, I had difficulties because in development environments the volumes overwrite the node_modules generated through Dockerfile.

I wrote a similar issue:
#20449

@docker-robot
Copy link

docker-robot bot commented Oct 19, 2024

Thanks for the pull request. We'd like to make our product docs better, but haven’t been able to review all the suggestions.
As our docs have also diverged, we do not have the bandwidth to review and rebase old pull requests.

If the updates are still relevant, review our contribution guidelines and rebase your pull request against the latest version of the docs, then mark it as fresh with a /remove-lifecycle stale comment.
If not, this pull request will be closed in 30 days. This helps our maintainers focus on the active pull requests.

Prevent pull requests from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Relates to Dockerfiles or docker build command lifecycle/stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants