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