Skip to content

Commit

Permalink
Clean up Docker image apt cache the right way (#1269)
Browse files Browse the repository at this point in the history
According to the official best practices guidelines outlined in the following document:
https://docs.docker.com/develop/develop-images/instructions/#apt-get

The official Debian/Ubuntu images have been configured to do apt-get clean automatically. Consequently, performing another `apt-get clean` is unnecessary. Instead, it is crucial to clear the cache for the index file by executing this command: `rm -rf /var/lib/apt/lists/*`.
  • Loading branch information
PeterDaveHello committed May 31, 2024
1 parent 2d46f4f commit a4dff8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FROM rust:1.73-slim-bookworm as builder
WORKDIR /build
RUN apt-get update && \
apt-get -y install make clang libc-dev curl cmake python3 protobuf-compiler pkg-config libssl3 libssl-dev git && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && \
curl -sLo sccache.tar.gz https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz && \
tar xzf sccache.tar.gz && \
mv sccache-*/sccache /usr/bin/sccache
Expand All @@ -32,7 +32,7 @@ RUN --mount=target=/root/.cache/sccache,type=cache --mount=target=/build/target,

FROM debian:bookworm-slim
VOLUME ["/repos", "/data"]
RUN apt-get update && apt-get -y install openssl ca-certificates libprotobuf-lite32 && apt-get clean
RUN apt-get update && apt-get -y install openssl ca-certificates libprotobuf-lite32 && rm -rf /var/lib/apt/lists/*
COPY model /model
COPY --from=builder /bleep /
COPY --from=builder /dylib /dylib
Expand Down

0 comments on commit a4dff8c

Please sign in to comment.