Dockerfile: use more recent tools & build a smaller executable

This commit is contained in:
Frank Denis 2020-06-06 21:27:17 +02:00
parent c4aad021da
commit 6a3fb509dc
2 changed files with 9 additions and 10 deletions

View file

@ -1,5 +1,7 @@
** **
!LICENSE
!README.md
!/share !/share
!/src !/src
!/CMakeLists.txt !/CMakeLists.txt

View file

@ -1,18 +1,15 @@
FROM alpine:3.9 as build FROM alpine:latest as build
WORKDIR /usr/src/minisign WORKDIR /usr/src/minisign
RUN apk add --no-cache \ RUN apk add --no-cache build-base cmake curl pkgconfig
g++==8.3.0-r0 \ RUN apk add --no-cache upx ||:
libsodium-dev==1.0.16-r0 RUN curl https://download.libsodium.org/libsodium/releases/LATEST.tar.gz | tar xzvf - && cd libsodium-stable && env CFLAGS="-Os" CPPFLAGS="-DED25519_NONDETERMINISTIC=1" ./configure --disable-dependency-tracking && make -j$(nproc) check && make install && cd .. && rm -fr libsodium-stable
COPY ./ ./ COPY ./ ./
RUN mkdir build && cd build && cmake -D BUILD_STATIC_EXECUTABLES=1 .. && make -j$(nproc)
RUN gcc -static -Os -s -o minisign src/*.c -lsodium RUN upx --lzma build/minisign ||:
FROM scratch FROM scratch
COPY --from=build /usr/src/minisign/build/minisign /usr/local/bin/
COPY --from=build /usr/src/minisign/minisign /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/minisign"] ENTRYPOINT ["/usr/local/bin/minisign"]