FROM alpine as base ARG PREFIX=/usr/local ARG DESTDIR=/opt/spm/libsodium-1.0.20 RUN apk update && apk add \ make \ gcc \ pkgconf \ musl-dev \ wget RUN wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.20.tar.gz RUN tar -xf libsodium-1.0.20.tar.gz WORKDIR /build-libsodium RUN CFLAGS="-ffunction-sections -fdata-sections -Os" \ ../libsodium-1.0.20/configure \ --prefix=$PREFIX \ --enable-static \ --enable-shared=no RUN make -j$(nproc) RUN make install DESTDIR=$DESTDIR FROM scratch COPY --from=base /opt/spm/libsodium-1.0.20/usr/local/ /opt/spm/libsodium-1.0.20