Skip to content

fix: forester Dockerfile #1881

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions forester/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM rust:1.79 AS builder
WORKDIR /app
RUN apt-get update && apt install -y clang lld pkgconf libssl-dev
ENV OPENSSL_DIR=/usr
ENV OPENSSL_LIB_DIR=/usr/lib
ENV OPENSSL_INCLUDE_DIR=/usr/include
RUN apt-get update && apt-get install -y \
clang \
lld \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
Comment on lines +3 to +8
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use --no-install-recommends and explicit clean-up to keep the builder layer slim

apt-get install -y without --no-install-recommends drags in a sizable set of optional packages (man-pages, locales, etc.) that are irrelevant for a builder container and slow CI/CD pulls.
A minimal install is enough for clang, lld, pkg-config, and libssl-dev.

-RUN apt-get update && apt-get install -y \
+RUN apt-get update && apt-get install -y --no-install-recommends \
     clang \
     lld \
     pkg-config \
     libssl-dev \
-    && rm -rf /var/lib/apt/lists/*
+    && apt-get clean && rm -rf /var/lib/apt/lists/*

(The added apt-get clean clears the local pkg cache that sometimes survives rm -rf /var/lib/apt/lists.)

🤖 Prompt for AI Agents
In forester/Dockerfile lines 3 to 8, the apt-get install command should include
the --no-install-recommends flag to avoid installing unnecessary optional
packages and reduce image size. Additionally, add an apt-get clean command after
installation to clear the local package cache, along with the existing rm -rf
/var/lib/apt/lists/* cleanup. This will keep the builder layer slim and optimize
CI/CD performance.


COPY .. .
RUN cargo build --release --package forester
Expand Down
Loading