FROM alpine as base ARG PREFIX=/opt/spm/cjson-1.7.16 RUN apk update && apk add \ git \ cmake \ make \ gcc \ musl-dev RUN git clone --depth 1 -b v1.7.16 https://github.com/DaveGamble/cJSON WORKDIR /cJSON RUN cmake -B build \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DBUILD_SHARED_LIBS=OFF \ -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