common/container: move masterdir image building to void-packages
see void-linux/void-docker#11
This commit is contained in:
parent
3b3f383a7c
commit
76c6e77f35
6 changed files with 207 additions and 0 deletions
35
common/container/Containerfile
Normal file
35
common/container/Containerfile
Normal file
|
@ -0,0 +1,35 @@
|
|||
# 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 common/repo-keys/* /target/var/db/xbps/keys/
|
||||
COPY common/container/setup.sh /bootstrap/setup.sh
|
||||
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 "${REPO}/bootstrap" \
|
||||
-r /target
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} bootstrap AS install
|
||||
ARG TARGETPLATFORM
|
||||
ARG MIRROR
|
||||
ARG LIBC
|
||||
COPY --from=bootstrap /target /target
|
||||
COPY common/container/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 "${REPO}/bootstrap" \
|
||||
-r /target \
|
||||
base-chroot void-repo-bootstrap
|
||||
|
||||
FROM scratch AS image
|
||||
COPY --link --from=install /target /
|
||||
RUN \
|
||||
install -dm1777 tmp; \
|
||||
xbps-reconfigure -fa; \
|
||||
rm -rf /var/cache/xbps/*
|
||||
CMD ["/bin/sh"]
|
29
common/container/docker-bake.hcl
Normal file
29
common/container/docker-bake.hcl
Normal file
|
@ -0,0 +1,29 @@
|
|||
variable "MIRROR" {
|
||||
default = "https://repo-ci.voidlinux.org/"
|
||||
}
|
||||
|
||||
target "docker-metadata-action" {}
|
||||
|
||||
target "_common" {
|
||||
inherits = ["docker-metadata-action"]
|
||||
dockerfile = "common/container/Containerfile"
|
||||
no-cache-filter = ["bootstrap"]
|
||||
cache-to = ["type=local,dest=/tmp/buildx-cache"]
|
||||
cache-from = ["type=local,src=/tmp/buildx-cache"]
|
||||
target = "image"
|
||||
args = {
|
||||
"MIRROR" = "${MIRROR}"
|
||||
}
|
||||
}
|
||||
|
||||
target "void-buildroot-glibc" {
|
||||
inherits = ["_common"]
|
||||
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
|
||||
args = { "LIBC" = "glibc" }
|
||||
}
|
||||
|
||||
target "void-buildroot-musl" {
|
||||
inherits = ["_common"]
|
||||
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
|
||||
args = { "LIBC" = "musl" }
|
||||
}
|
13
common/container/noextract.conf
Normal file
13
common/container/noextract.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
noextract=/etc/sv*
|
||||
noextract=/usr/share/man*
|
||||
noextract=/usr/lib/dracut*
|
||||
noextract=/etc/skel*
|
||||
noextract=/usr/lib/modprobe.d*
|
||||
noextract=/usr/lib/sysctl.d*
|
||||
noextract=/usr/lib/udev*
|
||||
noextract=/usr/share/bash-completion*
|
||||
noextract=/usr/share/fish/vendor-completions.d*
|
||||
noextract=/usr/share/zsh/site-functions*
|
||||
noextract=/usr/share/info*
|
||||
noextract=/usr/share/locale*
|
||||
noextract=/usr/lib/gconv*
|
29
common/container/setup.sh
Normal file
29
common/container/setup.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
: "${MIRROR:=https://repo-default.voidlinux.org/}"
|
||||
|
||||
suffix() {
|
||||
case "${LIBC:?}" in
|
||||
musl) echo "-musl" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
repo() {
|
||||
case "${ARCH:?}" in
|
||||
aarch64*) echo "${MIRROR}/current/aarch64" ;;
|
||||
*-musl) echo "${MIRROR}/current/musl" ;;
|
||||
*) echo "${MIRROR}/current" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "${TARGETPLATFORM:?}" in
|
||||
linux/arm/v6) ARCH="armv6l$(suffix)" ;;
|
||||
linux/arm/v7) ARCH="armv7l$(suffix)" ;;
|
||||
linux/arm64) ARCH="aarch64$(suffix)" ;;
|
||||
linux/amd64) ARCH="x86_64$(suffix)" ;;
|
||||
linux/386) ARCH="i686$(suffix)" ;;
|
||||
esac
|
||||
|
||||
REPO="$(repo)"
|
||||
|
||||
export ARCH REPO
|
Loading…
Add table
Add a link
Reference in a new issue