Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Improvements to Gitpod workspace and addition of Makefile for automation #2737
Improvements to Gitpod workspace and addition of Makefile for automation #2737
Changes from all commits
4bd1283
8153b1c
14ede58
4f88eaa
f4f4908
943676d
f7c6481
80662eb
3446d29
88a7179
58edff5
ff807b9
6198108
db1ddf0
606d18a
0ddc823
0af9c7b
4473558
ae22647
9e21dcb
4449985
18bc311
f648149
2abf6e0
6a0053a
d6db3e8
223d580
dfa0192
6010512
6750b8a
7b5c949
f9688eb
06ba0a6
d8f7c71
d5709ea
bc4c2db
0649c1d
2f96852
1101c7b
e112cb0
e4fb205
3532da0
56a61c6
37d1466
b84a7d5
4cbc9d7
870b4d8
c67b146
bd2432c
7259e96
5fce905
29dc807
f43adda
c8e921f
4d74fd4
d100d2a
ab261a8
60ae8d2
ef92701
15ade02
7d192be
c37807c
79e8c6d
f9364e8
7896684
a4c64ed
6022e07
742f834
2e6c5c3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This has a conceptual error. (We kinda became Dockerfile specialists with time).
Even though we might think that since it a separate stage, and that we often use that pattern to build optimized images, it doesn't do exactly what you might think.
Since it is a "FROM", then this stage will create a new image by using
cleanup
as a base image, like if it was a published image, but in this case, it is defined in the Dockerfile. Docker images work essentially by applying layers on top of each other, each layer being immutable. Just like if each layer was a tar file, and extracted in the same folder. (It is really like that it works).So, just before the RUN apt-get clean from line 83, the layers of the image will be all the layers that
cleanup
consists of, and at line 83, we are adding a new layer, that will, once applied, delete files in the filesystem of the image.That means that what will be downloaded and extracted will contain the files, and later on when finishing pulling, we will remove them. So there are no space gains at all, since they had to be included in the layer like at lines 17-20, 53, and 71, but don't appear in the final state. It is "wasted space". The solution for this is the (ugly) pattern that you often see in Dockerfiles, that you chain the clean commands directly in the same "RUN" as you created them. Each instruction in a Dockerfile makes a layer, that won't change.
Edit: I read a little too fast. Finally you used a
COPY --from
at the last stage that was based off the original one. So it doesn't really matter inside the final image, since all the stages will be discarded. But I'm not sure that the user added applied on line 91 will really work well if you copy and replace the whole filesystem. If you are to base your image onubuntu:jammy
, and then completely replace the whole filesystem with your contents, why need to have the final image download two times the contents of ubuntu:jammy? Once with the FROM (the 6 layers of the base image), and another one with theCOPY --from
, that includes the changes.If the current final image works as expected, (replacing the whole root filesystem), then changing the base image for the final stage to
scratch
, ie:FROM scratch
, that will work the same.FROM scratch
means to base the image on nothing, your image won't have layers before it.