cypress-docker-images icon indicating copy to clipboard operation
cypress-docker-images copied to clipboard

apt-get clean ?

Open gekkedev opened this issue 4 years ago • 6 comments

Is there a reason why apt-get clean is not being run after installing the dependencies? As far as I understand, these images are ready to go for using NPM/Yarn and to install Cypress; so there would not be any need to keep the repository cache, right? Especially in an NPM/Yarn-context it appears common to me to be very concerned about obsolete usage of disk space.

gekkedev avatar Jan 04 '21 14:01 gekkedev

Can you open a pull request with proposed change?

Sent from my iPhone

On Jan 4, 2021, at 09:02, gekkedev [email protected] wrote:

 Is there a reason why apt-get clean is not being run after installing the dependencies? As far as I understand, these images are ready to go for using NPM/Yarn and to install Cypress; so there would not be any need to keep the repository cache, right? Especially in an NPM/Yarn-context it appears common to me to be very concerned about obsolete usage of disk space.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bahmutov avatar Jan 04 '21 14:01 bahmutov

I'm not too familiar with apt-get clean though except for knowing that it removes some package-related cache. Maybe this line: https://github.com/cypress-io/cypress-docker-images/blob/deb9d80b52e21d7db19a5d08848a76680ed34fa7/base/10.0.0/Dockerfile#L28 effectively does the same? If so, my issue can probably be closed.
Submitted #429; this should demonstrate what I meant. Else, I'd be happy to quickly expand my PR to cover all for the dockerfiles.

gekkedev avatar Jan 10 '21 16:01 gekkedev

  1. What would apt-get clean do and how would it be any different? Will it remove files? Transient dependencies?
  2. We will never modify the existing Docker images, so even if we decide to add this command, it would be to change out template JavaScript file that makes the base images.

bahmutov avatar Jan 12 '21 16:01 bahmutov

I feel honored to answer you what the apt-get clean command does, but as you see in my previous reply I've tried providing a rough explanation which was apparently no good. I can't do it as good and precise as man pages, so I suggest you prefer this one over my explanation attempts. However, I can already tell you it should not remove dependences: you might have confused clean with purge.
Regarding the modification, we could determine that exact place later instead of arguing over it. The PR was created initially upon your request to sketch up when I would execute the command.

gekkedev avatar Feb 16 '21 10:02 gekkedev

@bahmutov because you asked me to explain what the command does, I still believe it would be better to discuss first if such a PR would be accepted in general instead of determining the right place where to implement it. Especially now that you closed #429 please ensure you even want this change, so that we don't waste our time with unnecessary PRs.

gekkedev avatar Mar 07 '21 16:03 gekkedev

Per the official Docker documentation, you don't need to add apt-get clean, since the Docker images implicitly run that command after every apt-get execution.

Official Debian and Ubuntu images automatically run apt-get clean, so explicit invocation is not required.

-Best practices for writing Dockerfiles

mtlynch avatar Feb 18 '22 03:02 mtlynch