stagex/packages/tini/Containerfile

38 lines
1.1 KiB
Text
Raw Normal View History

2024-08-29 19:02:30 +00:00
FROM scratch AS base
ENV VERSION=0.19.0
ENV SRC_HASH=0fd35a7030052acd9f58948d1d900fe1e432ee37103c5561554408bdac6bbf0d
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/krallin/tini/archive/${SRC_FILE}
FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch AS build
COPY --from=stagex/binutils . /
COPY --from=stagex/busybox . /
COPY --from=stagex/gcc . /
COPY --from=stagex/openssl . /
COPY --from=stagex/cmake . /
COPY --from=stagex/ninja . /
COPY --from=stagex/musl . /
COPY --from=stagex/make . /
RUN --network=none tar -xf ${SRC_FILE}
WORKDIR /tini-${VERSION}
ENV SOURCE_DATE_EPOCH=1
ENV CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
RUN --network=none <<-EOF
set -eux
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=None
cmake --build build --target all tini-static
EOF
FROM build AS install
RUN --network=none <<-EOF
set -eux
install -Dm755 build/tini /rootfs/usr/sbin/tini
install -Dm755 build/tini-static /rootfs/usr/sbin/tini-static
EOF
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /