Skip to content

Commit

Permalink
Merge pull request #29949 from cescoffier/update-musl-in-scratch-image
Browse files Browse the repository at this point in the history
Update musl and zlib versions in the documentation
  • Loading branch information
geoand committed Dec 19, 2022
2 parents 4f42868 + d0fb299 commit 2b112b1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/src/main/asciidoc/building-native-image.adoc
Expand Up @@ -653,7 +653,7 @@ Just add your application on top of this image, and you will get a tiny containe

Distroless images should not be used in production without rigorous testing.

=== Using a scratch base image
=== Build a container image from scratch

IMPORTANT: Scratch image support is experimental.

Expand All @@ -671,9 +671,9 @@ COPY --chown=quarkus:quarkus mvnw /code/mvnw
COPY --chown=quarkus:quarkus .mvn /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
RUN mkdir /musl && \
curl -L -o musl.tar.gz https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
curl -L -o musl.tar.gz https://more.musl.cc/11.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
tar -xvzf musl.tar.gz -C /musl --strip-components 1 && \
curl -L -o zlib.tar.gz https://zlib.net/zlib-1.2.12.tar.gz && \
curl -L -o zlib.tar.gz https://www.zlib.net/zlib-1.2.13.tar.gz && \
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && \
cd zlib && ./configure --static --prefix=/musl && \
make && make install && \
Expand All @@ -683,17 +683,20 @@ USER quarkus
WORKDIR /code
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
COPY src /code/src
RUN ./mvnw package -Pnative -Dquarkus.native.additional-build-args="--static","--libc=musl"
RUN ./mvnw package -Pnative -DskipTests -Dquarkus.native.additional-build-args="--static","--libc=musl"
## Stage 2 : create the docker final image
## Stage 2 : create the final image
FROM scratch
COPY --from=build /code/target/*-runner /application
EXPOSE 8080
ENTRYPOINT [ "/application" ]
----

Scratch images should not be used in production without rigorous testing.

=== Native executable compression
NOTE: The versions of musl and zlib may need to be updated to meet the native-image executable requirements (and UPX if you use native image compression).

=== Compress native images

Quarkus can compress the produced native executable using UPX.
More details on xref:./upx.adoc[UPX Compression documentation].
Expand Down

0 comments on commit 2b112b1

Please sign in to comment.