2024-02-12 01:08:57 +00:00
|
|
|
FROM alpine@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 as alpine
|
2023-12-23 07:14:08 +00:00
|
|
|
FROM debian@sha256:bac353db4cc04bc672b14029964e686cd7bad56fe34b51f432c1a1304b9928da as debian
|
2024-02-12 02:57:48 +00:00
|
|
|
FROM archlinux@sha256:1f83ba0580a15cd6ad1d02d62ad432ddc940f53f07d0e39c8982d6c9c74e53e0 as archlinux
|
2023-12-23 07:14:08 +00:00
|
|
|
|
2024-02-05 18:29:14 +00:00
|
|
|
FROM scratch as base
|
|
|
|
ENV VERSION=1.6.0
|
2024-02-06 00:14:20 +00:00
|
|
|
ENV SRC_FILE=stage0-posix-${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/oriansj/stage0-posix/releases/download/Release_${VERSION}/${SRC_FILE}
|
2024-02-05 18:29:14 +00:00
|
|
|
ENV SRC_HASH=9260ff69278366e5c056af7b8c436b74773eaa1330a0c6a6b8ab1b5f92e5065c
|
2024-02-09 11:23:22 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
2024-02-05 18:29:14 +00:00
|
|
|
COPY <<-EOF build.sh
|
|
|
|
#!/bin/sh
|
|
|
|
set -eux
|
2024-02-09 11:23:22 +00:00
|
|
|
tar -xf ${SRC_FILE}
|
2024-02-05 18:29:14 +00:00
|
|
|
cd stage0-posix-${VERSION}
|
|
|
|
bootstrap-seeds/POSIX/x86/kaem-optional-seed
|
|
|
|
mkdir -p /rootfs && cp -R * /rootfs/
|
|
|
|
cd /rootfs
|
2024-02-06 09:54:16 +00:00
|
|
|
sha256sum x86/bin/* > hashes.txt
|
2024-02-09 11:23:22 +00:00
|
|
|
find /rootfs -exec touch -hcd "@0" "{}" +
|
2024-02-05 18:29:14 +00:00
|
|
|
EOF
|
2023-12-23 07:14:08 +00:00
|
|
|
|
2024-02-05 18:29:14 +00:00
|
|
|
FROM base as build1
|
|
|
|
COPY --from=debian . /
|
2024-02-09 11:23:22 +00:00
|
|
|
RUN apt update && apt install -y wget gcc
|
|
|
|
COPY --from=base . /
|
2024-02-05 18:42:36 +00:00
|
|
|
RUN --network=none sh build.sh
|
2023-12-23 07:14:08 +00:00
|
|
|
|
2024-02-05 18:29:14 +00:00
|
|
|
FROM base as build2
|
2024-02-09 11:23:22 +00:00
|
|
|
COPY --from=archlinux . /
|
|
|
|
RUN pacman -Sy --noconfirm wget gcc
|
|
|
|
COPY --from=base . /
|
2024-02-05 18:42:36 +00:00
|
|
|
RUN --network=none sh build.sh
|
2024-02-05 18:29:14 +00:00
|
|
|
|
|
|
|
FROM base as build3
|
|
|
|
COPY --from=alpine . /
|
2024-02-09 11:23:22 +00:00
|
|
|
RUN apk add wget gcc
|
|
|
|
COPY --from=base . /
|
2024-02-05 18:42:36 +00:00
|
|
|
RUN --network=none sh build.sh
|
2023-12-23 07:14:08 +00:00
|
|
|
|
|
|
|
FROM scratch as compare
|
|
|
|
COPY --from=build1 /rootfs/ /a
|
|
|
|
COPY --from=build2 /rootfs/ /b
|
|
|
|
COPY --from=build3 /rootfs/ /c
|
|
|
|
|
|
|
|
FROM compare as test1
|
|
|
|
WORKDIR /a
|
2024-02-09 11:23:22 +00:00
|
|
|
RUN ["x86/bin/sha256sum","-c","/a/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/b/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/c/hashes.txt"]
|
2023-12-23 07:14:08 +00:00
|
|
|
|
|
|
|
FROM compare as test2
|
|
|
|
WORKDIR /b
|
2024-02-09 11:23:22 +00:00
|
|
|
RUN ["x86/bin/sha256sum","-c","/a/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/b/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/c/hashes.txt"]
|
2023-12-23 07:14:08 +00:00
|
|
|
|
|
|
|
FROM compare as test3
|
|
|
|
WORKDIR /c
|
2024-02-09 11:23:22 +00:00
|
|
|
RUN ["x86/bin/sha256sum","-c","/a/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/b/hashes.txt"]
|
|
|
|
RUN ["x86/bin/sha256sum","-c","/c/hashes.txt"]
|
2023-12-23 07:14:08 +00:00
|
|
|
|
2024-01-16 08:15:27 +00:00
|
|
|
FROM scratch as install
|
2024-02-09 11:23:22 +00:00
|
|
|
COPY --from=test1 /a/hashes.txt /a-hashes.txt
|
|
|
|
COPY --from=test2 /b/hashes.txt /b-hashes.txt
|
|
|
|
COPY --from=test3 /c/hashes.txt /c-hashes.txt
|
2023-12-23 07:14:08 +00:00
|
|
|
COPY --from=build1 /rootfs /
|
2024-01-16 08:15:27 +00:00
|
|
|
|
|
|
|
FROM scratch as package
|
|
|
|
COPY --from=install / /
|
2024-01-28 10:44:35 +00:00
|
|
|
CMD ["x86/bin/kaem","--version"]
|