|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | +FROM --platform=${BUILDPLATFORM} alpine:3.18 AS bootstrap |
| 3 | +ARG TARGETPLATFORM |
| 4 | +ARG MIRROR=https://repo-ci.voidlinux.org |
| 5 | +ARG LIBC |
| 6 | +RUN apk add ca-certificates curl && \ |
| 7 | + curl "${MIRROR}/static/xbps-static-static-0.59_5.$(uname -m)-musl.tar.xz" | tar vJx |
| 8 | +COPY keys/* /target/var/db/xbps/keys/ |
| 9 | +COPY setup.sh /bootstrap/setup.sh |
| 10 | +RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \ |
| 11 | + . /bootstrap/setup.sh; \ |
| 12 | + XBPS_TARGET_ARCH=${ARCH} xbps-install -S \ |
| 13 | + -R "${REPO}" \ |
| 14 | + -r /target |
| 15 | + |
| 16 | +FROM --platform=${BUILDPLATFORM} bootstrap AS install-default |
| 17 | +ARG TARGETPLATFORM |
| 18 | +ARG MIRROR |
| 19 | +ARG LIBC |
| 20 | +COPY --from=bootstrap /target /target |
| 21 | +COPY noextract.conf /target/etc/xbps.d/noextract.conf |
| 22 | +RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \ |
| 23 | + . /bootstrap/setup.sh; \ |
| 24 | + XBPS_TARGET_ARCH=${ARCH} xbps-install -y \ |
| 25 | + -R "${REPO}" \ |
| 26 | + -r /target \ |
| 27 | + xbps base-files dash coreutils grep run-parts sed gawk |
| 28 | + |
| 29 | +FROM --platform=${BUILDPLATFORM} bootstrap AS install-busybox |
| 30 | +ARG TARGETPLATFORM |
| 31 | +ARG MIRROR |
| 32 | +ARG LIBC |
| 33 | +COPY --from=bootstrap /target /target |
| 34 | +COPY noextract.conf /target/etc/xbps.d/noextract.conf |
| 35 | +RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \ |
| 36 | + . /bootstrap/setup.sh; \ |
| 37 | + XBPS_TARGET_ARCH=${ARCH} xbps-install -y \ |
| 38 | + -R "${REPO}" \ |
| 39 | + -r /target \ |
| 40 | + xbps base-files busybox-huge |
| 41 | + |
| 42 | +FROM --platform=${BUILDPLATFORM} bootstrap AS install-full |
| 43 | +ARG TARGETPLATFORM |
| 44 | +ARG MIRROR |
| 45 | +ARG LIBC |
| 46 | +COPY --from=bootstrap /target /target |
| 47 | +RUN --mount=type=cache,sharing=locked,target=/target/var/cache/xbps,id=repocache-${LIBC} \ |
| 48 | + . /bootstrap/setup.sh; \ |
| 49 | + XBPS_TARGET_ARCH=${ARCH} xbps-install -y \ |
| 50 | + -R "${REPO}" \ |
| 51 | + -r /target \ |
| 52 | + base-minimal |
| 53 | + |
| 54 | +FROM scratch AS image-default |
| 55 | +COPY --link --from=install-default /target / |
| 56 | +RUN --mount=type=tmpfs,target=/tmp \ |
| 57 | + xbps-reconfigure -a; \ |
| 58 | + rm -rf /var/cache/xbps/* |
| 59 | +CMD ["/bin/sh"] |
| 60 | + |
| 61 | +FROM scratch AS image-busybox |
| 62 | +COPY --link --from=install-busybox /target / |
| 63 | +RUN --mount=type=tmpfs,target=/tmp \ |
| 64 | + for util in $(/usr/bin/busybox --list); do \ |
| 65 | + [ ! -f "/usr/bin/$util" ] && /usr/bin/busybox ln -sfv busybox "/usr/bin/$util"; \ |
| 66 | + done; \ |
| 67 | + xbps-reconfigure -a; \ |
| 68 | + rm -rf /var/cache/xbps/* |
| 69 | +CMD ["/bin/sh"] |
| 70 | + |
| 71 | +FROM scratch AS image-full |
| 72 | +COPY --link --from=install-full /target / |
| 73 | +RUN --mount=type=tmpfs,target=/tmp \ |
| 74 | + xbps-reconfigure -a; \ |
| 75 | + rm -rf /var/cache/xbps/* |
| 76 | +CMD ["/bin/sh"] |
0 commit comments