diff --git a/.dockerignore b/.dockerignore index 381bdb6..ccfeb59 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,7 @@ ** +!LICENSE +!README.md !/share !/src !/CMakeLists.txt diff --git a/Dockerfile b/Dockerfile index ec52ffb..82dd35b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,15 @@ -FROM alpine:3.9 as build +FROM alpine:latest as build WORKDIR /usr/src/minisign -RUN apk add --no-cache \ - g++==8.3.0-r0 \ - libsodium-dev==1.0.16-r0 +RUN apk add --no-cache build-base cmake curl pkgconfig +RUN apk add --no-cache upx ||: +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 ./ ./ - -RUN gcc -static -Os -s -o minisign src/*.c -lsodium - +RUN mkdir build && cd build && cmake -D BUILD_STATIC_EXECUTABLES=1 .. && make -j$(nproc) +RUN upx --lzma build/minisign ||: FROM scratch - -COPY --from=build /usr/src/minisign/minisign /usr/local/bin/ - +COPY --from=build /usr/src/minisign/build/minisign /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/minisign"]