fix(docker): use multi-stage build to install curl (quarkus-micro-image:2.0 ships no microdnf)
CI / Build Native (push) Failing after 14m50s
CI / Build Native (push) Failing after 14m50s
The 2.0 rebuild of quarkus-micro-image removed microdnf to slim the image, so the inline 'microdnf install curl-minimal' step now fails with 'command not found'. Build curl-minimal in a ubi9/ubi-minimal builder stage, then copy only the curl binary + its runtime shared libs + CA bundle into the final quarkus-micro-image layer. Final image stays slim and the docker-compose healthcheck keeps working.
This commit is contained in:
+12
-2
@@ -1,9 +1,19 @@
|
||||
FROM registry.access.redhat.com/ubi9/ubi-minimal AS curl-builder
|
||||
RUN microdnf install -y curl-minimal && microdnf clean all \
|
||||
&& mkdir -p /out \
|
||||
&& install -m 0755 /usr/bin/curl /out/usr/bin/curl \
|
||||
&& for lib in $(ldd /usr/bin/curl | awk '/=>/ {print $3}' | sort -u); do \
|
||||
install -D -m 0755 "$lib" "/out$lib"; \
|
||||
done \
|
||||
&& cp -rP /etc/pki/ca-trust /out/etc/pki/ \
|
||||
&& cp -rP /etc/ssl /out/etc/
|
||||
|
||||
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||
WORKDIR /work/
|
||||
COPY build-output/shot-crafter-calculator-1.0.0-runner /work/application
|
||||
COPY --from=curl-builder /out/ /
|
||||
|
||||
RUN microdnf install -y curl-minimal && microdnf clean all \
|
||||
&& chmod 775 /work /work/application \
|
||||
RUN chmod 775 /work /work/application \
|
||||
&& chown -R 1001 /work \
|
||||
&& echo "securerandom.source=file:/dev/urandom" >> /work/application
|
||||
|
||||
|
||||
Reference in New Issue
Block a user