Skip to content

Combine apt-get in final docker image and remove cache #221

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
Closed

Combine apt-get in final docker image and remove cache #221

wants to merge 1 commit into from

Conversation

SuperSandro2000
Copy link
Contributor

Describe in detail the problem you had and how this PR fixes it

I had no problem but this reduces the amount of layers needed to download and removes the apt-get cache to reduce the image size

Is there an open issue you can link to?

nop

@SuperSandro2000 SuperSandro2000 requested a review from nhooyr as a code owner March 13, 2019 10:03
@nhooyr
Copy link
Contributor

nhooyr commented Mar 13, 2019

The two RUNs are intentionally separate for easier readability.

The apt-get package list removal looks reasonable to me.

@SuperSandro2000
Copy link
Contributor Author

Combined it is readable too and there is already a comment. Don't think we need to keep it seperated.

If we don't combine it the cache removal is totally useless as we download all the data with the first layer and then remove it in the next layer. This means if we don't combine the apts we would make the image overall worse.

And personally I use Alpine for every image because it is so damn small and keeps my hard drive empty. I am currently doing them myself and maybe going to contribute them if they work good.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 13, 2019

Combined it is readable too and there is already a comment. Don't think we need to keep it separated.

Readability is subjective. I understand you think its readable but imo it is harder. Also, there is no comment.

If we don't combine it the cache removal is totally useless as we download all the data with the first layer and then remove it in the next layer. This means if we don't combine the apts we would make the image overall worse.

That is true, but I think that's ok. The package cache is very small. I favour the readability of separate runs.

Thank you for the contribution but for the above reasons, I cannot merge it.

@nhooyr nhooyr closed this Mar 13, 2019
@SuperSandro2000
Copy link
Contributor Author

Well then I do my own like always. People just can't make nice small docker images.

@code-asher
Copy link
Member

@nhooyr Isn't it recommended to combine update and install commands? https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run

@ammario
Copy link
Member

ammario commented Mar 13, 2019

Yes, this PR is good at least because we want to couple the apt-get update layer with the apt-get install layer. It ensures the package cache is updated whenever we change which packages are installed.

@ammario ammario reopened this Mar 13, 2019
@SuperSandro2000
Copy link
Contributor Author

@coderasher oh thanks man! ❤️ I should get a printer and hang that on my wall.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 13, 2019

@nhooyr Isn't it recommended to combine update and install commands? https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run

Yes, but that would mean we add a apt-get update to the second RUN, not combine them.

Yes, this PR is good at least because we want to couple the apt-get update layer with the apt-get install layer. It ensures the package cache is updated whenever we change which packages are installed.

We don't have to combine the RUNs to do that.

@nhooyr nhooyr mentioned this pull request Mar 13, 2019
nhooyr added a commit that referenced this pull request Mar 13, 2019
Closes #221
Closes #230
Closes #203
@nhooyr nhooyr closed this in #231 Mar 13, 2019
@SuperSandro2000
Copy link
Contributor Author

Yes, but that would mean we add a apt-get update to the second RUN, not combine them.

I am glad you didn't do that cause that would be kinda stupid.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 13, 2019

@SuperSandro2000 Look man, we're all just trying to make code-server better. Can you please be a little more respectful?

I don't see why it would have been stupid. It would have been fine either way.

@SuperSandro2000
Copy link
Contributor Author

English is not my first language so it is a bit hard for me. I didn't mean it in an offensive way or so.

We would basically run the same command twice. I don't understand why you don't like the idea of just merging the two lines. Readability is just fine.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 13, 2019

English is not my first language so it is a bit hard for me. I didn't mean it in an offensive way or so.

Understood. It's all good.

code-asher pushed a commit that referenced this pull request Jun 19, 2019
Closes #221
Closes #230
Closes #203
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.

5 participants