Use scratch on final step

This reduce the final image size significantly.
This commit is contained in:
Xavier Del Campo Romero 2024-02-12 23:56:29 +01:00
parent 8c104a497d
commit 452fe86288
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
FROM alpine
FROM alpine as base
RUN apk update && apk add \
git \
make \
@ -17,3 +17,5 @@ RUN ./config -ffunction-sections -fdata-sections \
RUN make -j$(nproc --all)
RUN make test
RUN make install
FROM scratch
COPY --from=base /opt/spm/openssl-3.1.1 /opt/spm/openssl-3.1.1

View File

@ -1,4 +1,4 @@
FROM alpine
FROM alpine as base
ARG PREFIX=/opt/spm/cjson-1.7.16
RUN apk update && apk add \
git \
@ -15,3 +15,5 @@ RUN cmake -B build \
-DCMAKE_C_FLAGS="-ffunction-sections -fdata-sections"
RUN cmake --build build/ --parallel $(nproc --all)
RUN cmake --install build/
FROM scratch
COPY --from=base /opt/spm/cjson-1.7.16 /opt/spm/cjson-1.7.16