stagex/packages/json-c/Containerfile
2024-08-26 11:24:57 -07:00

42 lines
1.1 KiB
Docker

FROM scratch AS base
ENV VERSION=0.17
ENV SRC_HASH=7550914d58fb63b2c3546f3ccfbe11f1c094147bd31a69dcd23714d7956159e6
ENV SRC_FILE=json-c-${VERSION}.tar.gz
ENV SRC_SITE=https://s3.amazonaws.com/json-c_releases/releases/${SRC_FILE}
FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch AS build
COPY --from=stagex/busybox . /
COPY --from=stagex/binutils . /
COPY --from=stagex/cmake . /
COPY --from=stagex/ninja . /
COPY --from=stagex/musl . /
COPY --from=stagex/gcc . /
COPY --from=stagex/openssl . /
COPY --from=stagex/gcc . /
COPY --from=stagex/zlib . /
RUN tar -xf ${SRC_FILE}
WORKDIR /json-c-${VERSION}
RUN <<-EOF
set -eux
cmake \
-B build \
-G Ninja \
-Wno-dev \
-DCMAKE_INSTALL_PREFIX=/usr/ \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=ON \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_HOST_SYSTEM_NAME=Linux
cmake --build build --target all
EOF
FROM build AS install
RUN --network=none DESTDIR="/rootfs" cmake --install build
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /