Skip to content

Commit

Permalink
Fix caching issue and extra layers in images (#94)
Browse files Browse the repository at this point in the history
* Fix caching issue and extra layers in images

A previous change broke these instructions over multiple RUN statements, which results in extra layers in the final image, and impacts caching. More in the Dockerfile best practices https://docs.docker.com/develop/develop-images/instructions/#apt-get

* Missing confirmation flag

And I missed the confirmation flag in the second command.
  • Loading branch information
garethr authored Jan 22, 2025
1 parent e9b5502 commit 6953a63
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ COPY --from=snyk-alpine ./snyk /usr/local/bin/snyk

FROM parent as linux
COPY --from=snyk ./snyk /usr/local/bin/snyk
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y ca-certificates git
RUN apt-get auto-remove -y && apt-get clean -y && rm -rf /var/lib/apt/
RUN apt-get update && apt-get install -y \
ca-certificates \
git \
&& apt-get auto-remove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

0 comments on commit 6953a63

Please sign in to comment.