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

Dockerfile - Add infrequently layers earlier #8031

Merged
merged 1 commit into from
Sep 27, 2023
Merged

Dockerfile - Add infrequently layers earlier #8031

merged 1 commit into from
Sep 27, 2023

Conversation

tvalenta
Copy link
Contributor

This change moves a few items that are less likely to change towards the beginning of the Dockerfile. This should keep a new layer being created for ruby (~55MB) with each new image creation.

@tvalenta tvalenta requested a review from a team as a code owner September 13, 2023 23:22
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

Makes sense to me!

@tvalenta
Copy link
Contributor Author

Capturing today's layer info for posterity

ID            CREATED      CREATED BY                                     SIZE        COMMENT
f474bdd510bf  4 days ago   CMD ["bin/run"]                                0B          buildkit.dockerfile.v0
<missing>     4 days ago   USER root                                      0B          buildkit.dockerfile.v0
<missing>     4 days ago   ENV DEPENDABOT_NATIVE_HELPERS_PATH=/opt        0B          buildkit.dockerfile.v0
<missing>     4 days ago   ENV PATH=/home/dependabot/bin:/usr/local/s...  0B          buildkit.dockerfile.v0
<missing>     4 days ago   COPY LICENSE /home/dependabot # buildkit       4.61kB      buildkit.dockerfile.v0
<missing>     4 days ago   RUN |5 USER_UID=1000 USER_GID=1000 SHIM=ht...  104MB       buildkit.dockerfile.v0
<missing>     4 days ago   RUN |5 USER_UID=1000 USER_GID=1000 SHIM=ht...  3.21MB      buildkit.dockerfile.v0
<missing>     4 days ago   ARG LIBYAML_VERSION=0.2.5                      0B          buildkit.dockerfile.v0
<missing>     4 days ago   ARG BUNDLER_V2_VERSION=2.4.17                  0B          buildkit.dockerfile.v0
<missing>     4 days ago   COPY /usr/local /usr/local # buildkit          58.7MB      buildkit.dockerfile.v0
<missing>     4 days ago   WORKDIR /home/dependabot/dependabot-updater    1.02kB      buildkit.dockerfile.v0
<missing>     4 days ago   RUN |3 USER_UID=1000 USER_GID=1000 SHIM=ht...  36.9kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY terraform/Gemfile terraform/dependabo...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY swift/Gemfile swift/dependabot-swift....  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY python/Gemfile python/dependabot-pyth...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY pub/Gemfile pub/dependabot-pub.gemspe...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY nuget/Gemfile nuget/dependabot-nuget....  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY npm_and_yarn/Gemfile npm_and_yarn/dep...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY maven/Gemfile maven/dependabot-maven....  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY hex/Gemfile hex/dependabot-hex.gemspe...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY gradle/Gemfile gradle/dependabot-grad...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY go_modules/Gemfile go_modules/dependa...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY github_actions/Gemfile github_actions...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY git_submodules/Gemfile git_submodules...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY elm/Gemfile elm/dependabot-elm.gemspe...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY docker/Gemfile docker/dependabot-dock...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY composer/Gemfile composer/dependabot-...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY cargo/Gemfile cargo/dependabot-cargo....  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY bundler/Gemfile bundler/dependabot-bu...  5.63kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY common/lib/dependabot.rb common/lib/d...  4.1kB       buildkit.dockerfile.v0
<missing>     4 days ago   COPY common/Gemfile common/dependabot-comm...  7.17kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY updater/Gemfile updater/Gemfile.lock ...  12.8kB      buildkit.dockerfile.v0
<missing>     4 days ago   COPY omnibus omnibus # buildkit                11.8kB      buildkit.dockerfile.v0
<missing>     4 days ago   RUN |3 USER_UID=1000 USER_GID=1000 SHIM=ht...  2.45MB      buildkit.dockerfile.v0
<missing>     4 days ago   ARG SHIM=https://github.com/dependabot/git...  0B          buildkit.dockerfile.v0
<missing>     4 days ago   ENV GIT_LFS_SKIP_SMUDGE=1                      0B          buildkit.dockerfile.v0
<missing>     4 days ago   ENV DEPENDABOT=true                            0B          buildkit.dockerfile.v0
<missing>     4 days ago   WORKDIR /home/dependabot                       1.02kB      buildkit.dockerfile.v0
<missing>     4 days ago   ENV DEPENDABOT_HOME=/home/dependabot           0B          buildkit.dockerfile.v0
<missing>     4 days ago   USER dependabot                                0B          buildkit.dockerfile.v0
<missing>     4 days ago   RUN |2 USER_UID=1000 USER_GID=1000 /bin/ba...  351kB       buildkit.dockerfile.v0
<missing>     4 days ago   ARG USER_GID=1000                              0B          buildkit.dockerfile.v0
<missing>     4 days ago   ARG USER_UID=1000                              0B          buildkit.dockerfile.v0
<missing>     4 days ago   RUN /bin/bash -o pipefail -c apt-get updat...  418MB       buildkit.dockerfile.v0
c6b84b685f35  4 days ago   ENV DEBIAN_FRONTEND=noninteractive LC_ALL=...  0B          buildkit.dockerfile.v0
<missing>     4 days ago   SHELL [/bin/bash -o pipefail -c]               0B          buildkit.dockerfile.v0
<missing>     4 days ago   LABEL org.opencontainers.image.source=http...  0B          buildkit.dockerfile.v0
<missing>     4 weeks ago  /bin/sh -c #(nop)  CMD ["/bin/bash"]           0B          
<missing>     4 weeks ago  /bin/sh -c #(nop) ADD file:aa9b51e9f006786...  0B          
<missing>     4 weeks ago  /bin/sh -c #(nop)  LABEL org.opencontainer...  0B          
<missing>     4 weeks ago  /bin/sh -c #(nop)  LABEL org.opencontainer...  0B          
<missing>     4 weeks ago  /bin/sh -c #(nop)  ARG LAUNCHPAD_BUILD_ARCH    0B          
<missing>     4 weeks ago  /bin/sh -c #(nop)  ARG RELEASE                 0B          

@tvalenta
Copy link
Contributor Author

Makes sense to me!

Thanks for looking. Is there anything needed from me for this to be merged?

@deivid-rodriguez
Copy link
Contributor

Nope, it's ready from my side and I'll merge it when I get time!

This change moves a few items that are less likely to change towards the
beginning of the Dockerfile. This should keep a new layer being created
for ruby (~55MB) with each new image creation.
@deivid-rodriguez
Copy link
Contributor

Thanks!

@deivid-rodriguez deivid-rodriguez enabled auto-merge (squash) September 27, 2023 07:01
@deivid-rodriguez deivid-rodriguez merged commit d79e757 into dependabot:main Sep 27, 2023
80 checks passed
@tvalenta
Copy link
Contributor Author

For posterity, the latest image indicates that it works as intended. I think.

<missing>     33 minutes ago  COPY bundler/Gemfile bundler/dependabot-bu...  5.63kB      buildkit.dockerfile.v0
<missing>     33 minutes ago  COPY common/lib/dependabot.rb common/lib/d...  4.1kB       buildkit.dockerfile.v0
<missing>     33 minutes ago  COPY common/Gemfile common/dependabot-comm...  7.17kB      buildkit.dockerfile.v0
<missing>     33 minutes ago  COPY updater/Gemfile updater/Gemfile.lock ...  13.3kB      buildkit.dockerfile.v0
<missing>     37 hours ago    COPY omnibus omnibus # buildkit                11.8kB      buildkit.dockerfile.v0
<missing>     37 hours ago    RUN |4 USER_UID=1000 USER_GID=1000 LIBYAML...  2.45MB      buildkit.dockerfile.v0
<missing>     37 hours ago    ARG SHIM=https://github.com/dependabot/git...  0B          buildkit.dockerfile.v0
<missing>     37 hours ago    ENV GIT_LFS_SKIP_SMUDGE=1                      0B          buildkit.dockerfile.v0
<missing>     37 hours ago    ENV DEPENDABOT=true                            0B          buildkit.dockerfile.v0
<missing>     37 hours ago    RUN |3 USER_UID=1000 USER_GID=1000 LIBYAML...  3.21MB      buildkit.dockerfile.v0
<missing>     37 hours ago    ARG LIBYAML_VERSION=0.2.5                      0B          buildkit.dockerfile.v0
<missing>     37 hours ago    COPY /usr/local /usr/local # buildkit          58.7MB      buildkit.dockerfile.v0
<missing>     37 hours ago    COPY LICENSE /home/dependabot # buildkit       4.61kB      buildkit.dockerfile.v0
<missing>     37 hours ago    WORKDIR /home/dependabot                       1.02kB      buildkit.dockerfile.v0
<missing>     37 hours ago    ENV DEPENDABOT_HOME=/home/dependabot           0B          buildkit.dockerfile.v0
<missing>     37 hours ago    USER dependabot                                0B          buildkit.dockerfile.v0
<missing>     37 hours ago    RUN |2 USER_UID=1000 USER_GID=1000 /bin/ba...  351kB       buildkit.dockerfile.v0
<missing>     37 hours ago    ARG USER_GID=1000                              0B          buildkit.dockerfile.v0
<missing>     37 hours ago    ARG USER_UID=1000                              0B          buildkit.dockerfile.v0
<missing>     37 hours ago    RUN /bin/bash -o pipefail -c apt-get updat...  419MB       buildkit.dockerfile.v0
c6b84b685f35  37 hours ago    ENV DEBIAN_FRONTEND=noninteractive LC_ALL=...  0B          buildkit.dockerfile.v0
<missing>     37 hours ago    SHELL [/bin/bash -o pipefail -c]               0B          buildkit.dockerfile.v0
<missing>     37 hours ago    LABEL org.opencontainers.image.source=http...  0B          buildkit.dockerfile.v0
<missing>     6 weeks ago     /bin/sh -c #(nop)  CMD ["/bin/bash"]           0B
<missing>     6 weeks ago     /bin/sh -c #(nop) ADD file:aa9b51e9f006786...  0B
<missing>     6 weeks ago     /bin/sh -c #(nop)  LABEL org.opencontainer...  0B
<missing>     6 weeks ago     /bin/sh -c #(nop)  LABEL org.opencontainer...  0B
<missing>     6 weeks ago     /bin/sh -c #(nop)  ARG LAUNCHPAD_BUILD_ARCH    0B
<missing>     6 weeks ago     /bin/sh -c #(nop)  ARG RELEASE                 0B

@tvalenta tvalenta deleted the dockerLayerReordering branch September 28, 2023 20:23
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
This change moves a few items that are less likely to change towards the
beginning of the Dockerfile. This should keep a new layer being created
for ruby (~55MB) with each new image creation.
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.

2 participants