-
Notifications
You must be signed in to change notification settings - Fork 76
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
Reduce builder image size #240
Comments
Builder images do not try to be small, but in this case, yes. Just adding a rm in the script should work. |
Unfortunately no, it must be copied, extracted and deleted in the same operation for it to not being recorded in the layer. - COPY /target/artifacts/graalvm-jdk-17.0.7-linux-x64.tar.gz /tmp/graalvm/graalvm-jdk-17.0.7-linux-x64.tar.gz
RUN
+ --mount=type=bind,source=/target/artifacts/graalvm-jdk-17.0.7-linux-x64.tar.gz,target=/tmp/graalvm/graalvm-jdk-17.0.7-linux-x64.tar.gz \
tar xzf /tmp/graalvm/graalvm-jdk-17.0.7-linux-x64.tar.gz -C /opt \
&& mv /opt/graalvm-community-openjdk-17.0.7* /opt/graalvm \
- && rm -Rf /tmp/graalvm-jdk-17.0.7-linux-x64.tar.gz If that's ok with you, I'll open a PR with it |
Does that command works with |
I'm not really familiar with Podman but with version 4.5.1, it worked (aliased docker to podman) |
I was looking at
quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.3.2-java17-amd64
with dive and noticed it reported a temporary file costing ~250MB on the final imageThis can be avoided by using a multistage build and extracting the tar in another stage.
From what I see, the biggest gain are on the following images but the same fix could be applied to any image using artifacts :
I'll first open a PR for
ubi-quarkus-graalvmce-builder-image
andubi-quarkus-graalvmce-s2i
since they share the same moduleThe text was updated successfully, but these errors were encountered: