diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a101163
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+build.log
+*.tgz
diff --git a/Makefile b/Makefile
index a6bb03f..77f3687 100644
--- a/Makefile
+++ b/Makefile
@@ -1,267 +1,324 @@
-export SOURCE_DATE_EPOCH = 0
export REGISTRY := local
+export PLATFORM := linux/amd64
export BUILDER := $(shell which docker)
+export SOURCE_DATE_EPOCH = 0
+clean_logs := $(shell rm *.log 2>&1 >/dev/null || :)
-define build
- ${BUILDER} \
- build \
- -t $(REGISTRY)/$(1):$(2) \
- --build-arg REGISTRY=$(REGISTRY) \
- --target $(3) \
- --output type=oci,dest=$@ \
- $(1)
-endef
+DEFAULT_GOAL := default
+.PHONY: default
+default: all
+.PHONY: all
+all: \
+ bootstrap.tgz \
+ gcc.tgz \
+ busybox.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ bash.tgz \
+ zlib.tgz \
+ perl.tgz \
+ linux-headers.tgz \
+ openssl.tgz \
+ python.tgz \
+ py-setuptools.tgz \
+ ca-certificates.tgz \
+ curl.tgz \
+ m4.tgz \
+ autoconf.tgz \
+ automake.tgz \
+ sed.tgz \
+ libtool.tgz \
+ libunwind.tgz \
+ ninja.tgz \
+ cmake.tgz \
+ libxml2 \
+ llvm13.tgz \
+ rust1.54.tgz \
+ llvm.tgz \
+ rust1.55.tgz
-out/bootstrap.oci.tgz:
+bootstrap.tgz:
$(call build,bootstrap)
-out/musl.oci.tgz: \
- out/bootstrap.oci.tgz
+musl.tgz: bootstrap.tgz
$(call build,musl)
-out/busybox.oci.tgz: \
- out/bootstrap.oci.tgz
+busybox.tgz: bootstrap.tgz
$(call build,busybox)
-out/binutils.oci.tgz: \
- out/bootstrap.oci.tgz \
- out/musl.oci.tgz
+binutils.tgz: bootstrap.tgz
$(call build,binutils)
-out/linux-headers.oci.tgz:
- $(call build,linux-headers)
-
-out/gcc.oci.tgz: \
- out/bootstrap.oci.tgz \
- out/musl.oci.tgz
+gcc.tgz: \
+ bootstrap.tgz \
+ musl.tgz
$(call build,gcc)
-out/make.oci.tgz: \
- out/bootstrap.oci.tgz \
- out/musl.oci.tgz
+make.tgz: bootstrap.tgz
$(call build,make)
-out/ca-certificates.oci.tgz:
+ca-certificates.tgz:
$(call build,ca-certificates)
-out/bash.oci.tgz: \
- out/gcc.oci.tgz
+bash.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz
$(call build,bash)
-out/m4.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz
+m4.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz
$(call build,m4)
-out/autoconf.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/perl.oci.tgz \
- out/m4.oci.tgz
- $(call build,autoconf)
-
-out/automake.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/perl.oci.tgz \
- out/autoconf.oci.tgz \
- out/m4.oci.tgz
- $(call build,automake)
-
-out/sed.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz
- $(call build,sed)
-
-out/libtool.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/bash.oci.tgz \
- out/sed.oci.tgz \
- out/m4.oci.tgz
- $(call build,libtool)
-
-out/pkgconf.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/libtool.oci.tgz
- $(call build,pkgconf)
-
-out/libxml2.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/bash.oci.tgz \
- out/python.oci.tgz \
- out/sed.oci.tgz \
- out/m4.oci.tgz \
- out/autoconf.oci.tgz \
- out/automake.oci.tgz \
- out/pkgconf.oci.tgz \
- out/libtool.oci.tgz
- $(call build,libxml2)
-
-out/libunwind.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/bash.oci.tgz \
- out/autoconf.oci.tgz \
- out/automake.oci.tgz \
- out/libtool.oci.tgz
- $(call build,libunwind)
-
-out/openssl.oci.tgz: \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/busybox.oci.tgz \
- out/linux-headers.oci.tgz \
- out/musl.oci.tgz
- $(call build,openssl)
-
-out/go.oci.tgz: \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/busybox.oci.tgz \
- out/bash.oci.tgz \
- out/musl.oci.tgz
- $(call build,go)
-
-out/perl.oci.tgz: \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/busybox.oci.tgz \
- out/make.oci.tgz \
- out/musl.oci.tgz
+perl.tgz: \
+ gcc.tgz \
+ binutils.tgz \
+ busybox.tgz \
+ make.tgz \
+ musl.tgz
$(call build,perl)
-out/curl.oci.tgz: \
- out/gcc.oci.tgz \
- out/musl.oci.tgz \
- out/busybox.oci.tgz \
- out/make.oci.tgz \
- out/binutils.oci.tgz \
- out/openssl.oci.tgz \
- out/ca-certificates.oci.tgz
+autoconf.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ perl.tgz \
+ m4.tgz
+ $(call build,autoconf,,fetch)
+ $(call build,autoconf)
+
+automake.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ perl.tgz \
+ autoconf.tgz \
+ m4.tgz
+ $(call build,automake)
+
+sed.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz
+ $(call build,sed)
+
+libtool.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ bash.tgz \
+ sed.tgz \
+ m4.tgz
+ $(call build,libtool)
+
+pkgconf.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ libtool.tgz
+ $(call build,pkgconf)
+
+libxml2.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ bash.tgz \
+ python.tgz \
+ sed.tgz \
+ m4.tgz \
+ autoconf.tgz \
+ automake.tgz \
+ pkgconf.tgz \
+ libtool.tgz
+ $(call build,libxml2)
+
+libunwind.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ bash.tgz \
+ autoconf.tgz \
+ automake.tgz \
+ libtool.tgz
+ $(call build,libunwind)
+
+linux-headers.tgz:
+ $(call build,linux-headers)
+
+openssl.tgz: \
+ gcc.tgz \
+ binutils.tgz \
+ busybox.tgz \
+ linux-headers.tgz \
+ musl.tgz
+ $(call build,openssl)
+
+go.tgz: \
+ gcc.tgz \
+ binutils.tgz \
+ busybox.tgz \
+ bash.tgz \
+ musl.tgz
+ $(call build,go)
+
+curl.tgz: \
+ gcc.tgz \
+ musl.tgz \
+ busybox.tgz \
+ make.tgz \
+ binutils.tgz \
+ openssl.tgz \
+ ca-certificates.tgz
$(call build,curl)
-out/python.oci.tgz: \
- out/gcc.oci.tgz \
- out/perl.oci.tgz \
- out/binutils.oci.tgz \
- out/busybox.oci.tgz \
- out/openssl.oci.tgz \
- out/make.oci.tgz \
- out/musl.oci.tgz
+python.tgz: \
+ gcc.tgz \
+ perl.tgz \
+ binutils.tgz \
+ busybox.tgz \
+ openssl.tgz \
+ make.tgz \
+ musl.tgz
$(call build,python)
-out/ninja.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/openssl.oci.tgz \
- out/python.oci.tgz
+ninja.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz \
+ openssl.tgz \
+ python.tgz
$(call build,ninja)
-out/cmake.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/ninja.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz \
- out/linux-headers.oci.tgz
+cmake.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ ninja.tgz \
+ musl.tgz \
+ make.tgz \
+ linux-headers.tgz
$(call build,cmake)
-out/py-setuptools.oci.tgz: \
- out/busybox.oci.tgz \
- out/python.oci.tgz
+py-setuptools.tgz: \
+ busybox.tgz \
+ python.tgz
$(call build,py-setuptools)
-out/zlib.oci.tgz: \
- out/busybox.oci.tgz \
- out/gcc.oci.tgz \
- out/binutils.oci.tgz \
- out/musl.oci.tgz \
- out/make.oci.tgz
+zlib.tgz: \
+ busybox.tgz \
+ gcc.tgz \
+ binutils.tgz \
+ musl.tgz \
+ make.tgz
$(call build,zlib)
-out/llvm.oci.tgz: \
- out/gcc.oci.tgz \
- out/python.oci.tgz \
- out/py-setuptools.oci.tgz \
- out/perl.oci.tgz \
- out/binutils.oci.tgz \
- out/cmake.oci.tgz \
- out/ninja.oci.tgz \
- out/busybox.oci.tgz \
- out/musl.oci.tgz
+llvm13.tgz: \
+ gcc.tgz \
+ python.tgz \
+ py-setuptools.tgz \
+ perl.tgz \
+ binutils.tgz \
+ cmake.tgz \
+ ninja.tgz \
+ busybox.tgz \
+ musl.tgz
+ $(call build,llvm,13.0.1)
+
+llvm.tgz: \
+ gcc.tgz \
+ python.tgz \
+ py-setuptools.tgz \
+ perl.tgz \
+ binutils.tgz \
+ cmake.tgz \
+ ninja.tgz \
+ busybox.tgz \
+ musl.tgz
$(call build,llvm)
-out/llvm13.oci.tgz: \
- out/gcc.oci.tgz \
- out/python.oci.tgz \
- out/py-setuptools.oci.tgz \
- out/perl.oci.tgz \
- out/binutils.oci.tgz \
- out/cmake.oci.tgz \
- out/ninja.oci.tgz \
- out/busybox.oci.tgz \
- out/musl.oci.tgz
- $(call build,llvm13)
+rust1.54.tgz: \
+ gcc.tgz \
+ bash.tgz \
+ zlib.tgz \
+ python.tgz \
+ py-setuptools.tgz \
+ curl.tgz \
+ perl.tgz \
+ libunwind.tgz \
+ llvm13.tgz \
+ binutils.tgz \
+ cmake.tgz \
+ make.tgz \
+ busybox.tgz \
+ musl.tgz
+ $(call build,rust,1.54.0,bootstrap-package)
-out/rust1.54.oci.tgz: \
- out/gcc.oci.tgz \
- out/bash.oci.tgz \
- out/zlib.oci.tgz \
- out/python.oci.tgz \
- out/py-setuptools.oci.tgz \
- out/curl.oci.tgz \
- out/perl.oci.tgz \
- out/libunwind.oci.tgz \
- out/llvm13.oci.tgz \
- out/binutils.oci.tgz \
- out/cmake.oci.tgz \
- out/make.oci.tgz \
- out/busybox.oci.tgz \
- out/musl.oci.tgz
- $(call build,rust,1.54.0,bootstrap)
+rust1.55.tgz: rust1.54.tgz
+ $(call build,rust,1.55.0,package,--build-arg BUILD_VERSION=1.54.0)
-out/rust1.55.oci.tgz: out/rust1.54.oci.tgz
- $(call build,rust,1.55.0)
-
-test:
- docker build -t $(REGISTRY)/test-c tests/c
- docker build -t $(REGISTRY)/test-go tests/go
- docker build -t $(REGISTRY)/test-perl tests/perl
- @printf "\nOcirep Test Suite\n"
- @printf "go -> "
- @docker run -i $(REGISTRY)/test-go | grep Success
- @printf "c -> "
- @docker run -i $(REGISTRY)/test-c | grep Success
- @printf "perl -> "
- @docker run -i $(REGISTRY)/test-perl | grep Success
+# Build package with chosen $(BUILDER)
+# Supported BUILDERs: docker
+# Usage: $(call build,$(NAME),$(VERSION),$(TARGET),$(EXTRA_ARGS))
+# Notes:
+# - Packages are expected to use the following layer names in order:
+# - "fetch": [optional] obtain any artifacts from the internet.
+# - "build": [optional] do any required build work
+# - "package": [required] scratch layer exporting artifacts for distribution
+# - "test": [optional] define any tests
+# - Packages may prefix layer names with "text-" if more than one is desired
+# - VERSION will be set as a build-arg if defined, otherwise it is "latest"
+# - TARGET defaults to "package"
+# - EXTRA_ARGS will be blindly injected
+# - packages may also define a "test" layer
+# TODO:
+# - try to disable networking on fetch layers with something like:
+# $(if $(filter fetch,$(lastword $(subst -, ,$(TARGET)))),,--network=none)
+# - actually output OCI files for each build (vs plain tar)
+# - output manifest.txt of all tar/digest hashes for an easy git diff
+# - support buildah and podman
+define build
+ $(eval NAME := $(1))
+ $(eval VERSION := $(if $(2),$(2),latest))
+ $(eval TARGET := $(if $(3),$(3),package))
+ $(eval EXTRA_ARGS := $(if $(4),$(4),))
+ $(eval BUILD_CMD := \
+ SOURCE_DATE_EPOCH=1 \
+ $(BUILDER) \
+ build \
+ -t $(REGISTRY)/$(NAME):$(VERSION) \
+ --build-arg REGISTRY=$(REGISTRY) \
+ --platform $(PLATFORM) \
+ --progress=plain \
+ $(if $(filter latest,$(VERSION)),,--build-arg VERSION=$(VERSION)) \
+ --target $(TARGET) \
+ $(EXTRA_ARGS) \
+ $(NAME) \
+ )
+ $(eval TIMESTAMP := $(shell TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"))
+ echo $(TIMESTAMP) $(BUILD_CMD) >> build.log
+ $(BUILD_CMD)
+ $(if $(filter package,$(TARGET)),$(BUILDER) save $(REGISTRY)/$(NAME):$(VERSION),)
+endef
diff --git a/autoconf/Dockerfile b/autoconf/Dockerfile
index 1b78350..16d08a9 100644
--- a/autoconf/Dockerfile
+++ b/autoconf/Dockerfile
@@ -1,5 +1,4 @@
ARG REGISTRY=local
-FROM ${REGISTRY}/busybox:latest as busybox
FROM ${REGISTRY}/gcc:latest as gcc
FROM ${REGISTRY}/binutils:latest as binutils
FROM ${REGISTRY}/musl:latest as musl
@@ -7,13 +6,19 @@ FROM ${REGISTRY}/make:latest as make
FROM ${REGISTRY}/m4:latest as m4
FROM ${REGISTRY}/perl:latest as perl
-FROM busybox as build
-ENV SRC_SITE=https://ftp.gnu.org/gnu/autoconf
-ENV SRC_VERSION=2.71
-ENV SRC_HASH=f14c83cfebcc9427f2c3cea7258bd90df972d92eb26752da4ddad81c87a0faa4
-RUN wget ${SRC_SITE}/autoconf-${SRC_VERSION}.tar.xz
-RUN echo "${SRC_HASH} autoconf-${SRC_VERSION}.tar.xz" | sha256sum -c
-RUN tar -xf autoconf-${SRC_VERSION}.tar.xz
+FROM ${REGISTRY}/busybox:latest as base
+ENV SRC_SITE https://ftp.gnu.org/gnu/autoconf
+ENV SRC_VERSION 2.71
+ENV SRC_HASH f14c83cfebcc9427f2c3cea7258bd90df972d92eb26752da4ddad81c87a0faa4
+ENV SRC_FILE autoconf-${SRC_VERSION}.tar.xz
+
+FROM base as fetch
+RUN set -eux; \
+ wget ${SRC_SITE}/${SRC_FILE}; \
+ echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c
+
+FROM fetch as build
+RUN tar -xf ${SRC_FILE}
WORKDIR autoconf-${SRC_VERSION}
COPY --from=gcc . /
COPY --from=binutils . /
@@ -29,7 +34,7 @@ RUN set -eux; \
RUN make DESTDIR=/home/user/rootfs install
COPY --from=perl . /home/user/rootfs/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/autoreconf"]
CMD ["--version"]
diff --git a/automake/Dockerfile b/automake/Dockerfile
index ee98c12..3ba6ec3 100644
--- a/automake/Dockerfile
+++ b/automake/Dockerfile
@@ -31,7 +31,7 @@ RUN make DESTDIR=/home/user/rootfs install
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
COPY --from=perl . /home/user/rootfs/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/automake"]
CMD ["--version"]
diff --git a/bash/Dockerfile b/bash/Dockerfile
index 9141058..5aa3a01 100644
--- a/bash/Dockerfile
+++ b/bash/Dockerfile
@@ -1,20 +1,45 @@
ARG REGISTRY=local
-from ${REGISTRY}/bootstrap as bootstrap
+from ${REGISTRY}/binutils as binutils
+from ${REGISTRY}/gcc as gcc
+from ${REGISTRY}/musl as musl
+from ${REGISTRY}/make as make
-FROM bootstrap as build
-ENV SOURCE_SITE=https://ftp.gnu.org/gnu/bash
-ENV SOURCE_VERSION=5.2.15
-ENV SOURCE_HASH=13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c
-RUN wget ${SOURCE_SITE}/bash-${SOURCE_VERSION}.tar.gz
-RUN echo "${SOURCE_HASH} bash-${SOURCE_VERSION}.tar.gz" | sha256sum -c
-RUN tar -xzf bash-${SOURCE_VERSION}.tar.gz
-WORKDIR bash-${SOURCE_VERSION}
+from ${REGISTRY}/busybox as base
+ENV SRC_SITE=https://ftp.gnu.org/gnu/bash
+ENV SRC_VERSION=5.2.21
+ENV SRC_HASH=c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8
+ENV SRC_FILE=bash-${SRC_VERSION}.tar.gz
+
+FROM base as fetch
+RUN set -eux; \
+ wget ${SRC_SITE}/${SRC_FILE}; \
+ echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c
+
+FROM fetch as build
+RUN tar -xzf ${SRC_FILE}
+WORKDIR bash-${SRC_VERSION}
+COPY --from=gcc . /
+COPY --from=binutils . /
+COPY --from=make . /
+COPY --from=musl . /
RUN set -eux; \
./configure \
+ --build=x86_64-unknown-linux-musl \
+ --host=x86_64-unknown-linux-musl \
--prefix=/usr \
- --enable-static-link; \
- make DESTDIR=/home/user/rootfs
-RUN make install DESTDIR=/home/user/rootfs
+ --bindir=/bin \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-nls \
+ --enable-readline \
+ --without-curses \
+ --without-bash-malloc; \
+ make
+RUN make DESTDIR=/home/user/rootfs install
+RUN ls -Rlah /home/user/rootfs
+COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
+ENTRYPOINT ["/bin/bash"]
+CMD ["--version"]
diff --git a/binutils/Dockerfile b/binutils/Dockerfile
index 14ccc21..c694b5a 100644
--- a/binutils/Dockerfile
+++ b/binutils/Dockerfile
@@ -47,7 +47,7 @@ RUN set -ex; \
make DESTDIR="/home/user/rootfs" install;
COPY --from=musl /usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/bin/ld"]
CMD ["--version"]
diff --git a/bootstrap/Dockerfile b/bootstrap/Dockerfile
index 9803277..2d53f32 100644
--- a/bootstrap/Dockerfile
+++ b/bootstrap/Dockerfile
@@ -1,5 +1,8 @@
-FROM alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978
+FROM alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 as seed
+FROM seed as fetch
RUN set -ex; \
apk update; \
apk add gcc g++ libc-dev make linux-headers patch
+
+FROM fetch as package
diff --git a/busybox/Dockerfile b/busybox/Dockerfile
index df8adc7..d774b51 100644
--- a/busybox/Dockerfile
+++ b/busybox/Dockerfile
@@ -1,14 +1,18 @@
ARG REGISTRY=local
-FROM ${REGISTRY}/bootstrap as bootstrap
+FROM ${REGISTRY}/bootstrap as base
+ENV SRC_SITE=https://busybox.net/downloads
+ENV SRC_VERSION=1.35.0
+ENV SRC_HASH=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694
+ENV SRC_FILE=busybox-${SRC_VERSION}.tar.bz2
-FROM bootstrap as build
-ENV SOURCE_SITE=https://busybox.net/downloads
-ENV SOURCE_VERSION=1.35.0
-ENV SOURCE_HASH=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694
-RUN wget ${SOURCE_SITE}/busybox-${SOURCE_VERSION}.tar.bz2
-RUN echo "${SOURCE_HASH} busybox-${SOURCE_VERSION}.tar.bz2" | sha256sum -c
-RUN tar -xjf busybox-${SOURCE_VERSION}.tar.bz2
-WORKDIR busybox-${SOURCE_VERSION}
+FROM base as fetch
+RUN set -eux; \
+ wget ${SRC_SITE}/${SRC_FILE}; \
+ echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c
+
+FROM fetch as build
+RUN tar -xjf ${SRC_FILE}
+WORKDIR busybox-${SRC_VERSION}
RUN set -eux; \
setConfs=' \
CONFIG_AR=y \
@@ -51,7 +55,7 @@ RUN set -eux; \
RUN make
RUN cp busybox /
-FROM scratch
+FROM scratch as package
COPY --from=build busybox /
RUN ["/busybox","mkdir","/bin"]
RUN ["/busybox","--install","-s","/bin"]
@@ -63,3 +67,7 @@ RUN chown -R 1000:1000 /home/user /tmp /var/tmp
WORKDIR /home/user
USER 1000:1000
ENTRYPOINT ["/bin/sh"]
+ENV TZ=UTC
+ENV LANG=C.UTF-8
+ENV SOURCE_DATE_EPOCH=1
+ENV PS1=busybox
diff --git a/ca-certificates/Dockerfile b/ca-certificates/Dockerfile
index 3b4d2cc..44a6601 100644
--- a/ca-certificates/Dockerfile
+++ b/ca-certificates/Dockerfile
@@ -1,2 +1,2 @@
-FROM scratch
+FROM scratch as package
COPY cacert.pem /etc/ssl/certs/ca-certificates.crt
diff --git a/cmake/Dockerfile b/cmake/Dockerfile
index 881c22e..f16fac2 100644
--- a/cmake/Dockerfile
+++ b/cmake/Dockerfile
@@ -43,7 +43,7 @@ COPY --from=gcc /usr/lib/* /home/user/rootfs/usr/lib/
COPY --from=gcc /usr/lib64/* /home/user/rootfs/usr/lib/
COPY --from=openssl /usr/lib/* /home/user/rootfs/usr/lib/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/cmake"]
diff --git a/curl/Dockerfile b/curl/Dockerfile
index aabb798..f90bd66 100644
--- a/curl/Dockerfile
+++ b/curl/Dockerfile
@@ -39,7 +39,7 @@ COPY --from=musl . /home/user/rootfs/
COPY --from=openssl . /home/user/rootfs/
COPY --from=ca-certificates . /home/user/rootfs/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/curl"]
diff --git a/gcc/Dockerfile b/gcc/Dockerfile
index 1ea888d..43adf52 100644
--- a/gcc/Dockerfile
+++ b/gcc/Dockerfile
@@ -1,26 +1,45 @@
ARG REGISTRY=local
FROM ${REGISTRY}/musl:latest as musl
-FROM ${REGISTRY}/bootstrap:latest as build
-ENV GCC_SITE https://mirrors.kernel.org/gnu/gcc
-ENV GCC_VERSION 12.2.0
-ENV GCC_HASH e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
+FROM ${REGISTRY}/bootstrap:latest as base
+ENV VERSION 12.2.0
+ENV SRC_FILE gcc-$VERSION.tar.xz
+ENV SRC_SITE https://mirrors.kernel.org/gnu/gcc/gcc-${VERSION}
+ENV SRC_HASH e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
+ENV DEP_SITE https://gcc.gnu.org/pub/gcc/infrastructure/
+ENV GMP_FILE gmp-6.2.1.tar.bz2
+ENV GMP_HASH eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
+ENV MPFR_FILE mpfr-4.1.0.tar.bz2
+ENV MPFR_HASH feced2d430dd5a97805fa289fed3fc8ff2b094c02d05287fd6133e7f1f0ec926
+ENV MPC_FILE mpc-1.2.1.tar.gz
+ENV MPC_HASH 17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459
+ENV ISL_FILE isl-0.24.tar.bz2
+ENV ISL_HASH fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0
-RUN echo wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
-RUN wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
-RUN echo "${GCC_HASH} gcc-${GCC_VERSION}.tar.xz" | sha256sum -c
-RUN tar -xf gcc-${GCC_VERSION}.tar.xz
-WORKDIR gcc-${GCC_VERSION}
-RUN set -ex; \
+FROM base as fetch
+RUN set -eux; \
+ wget ${SRC_SITE}/${SRC_FILE}; \
+ echo "${SRC_HASH} ${SRC_FILE}" | sha256sum -c; \
+ wget ${DEP_SITE}/${GMP_FILE}; \
+ echo "${GMP_HASH} ${GMP_FILE}" | sha256sum -c; \
+ wget ${DEP_SITE}/${MPFR_FILE}; \
+ echo "${MPFR_HASH} ${MPFR_FILE}" | sha256sum -c; \
+ wget ${DEP_SITE}/${MPC_FILE}; \
+ echo "${MPC_HASH} ${MPC_FILE}" | sha256sum -c; \
+ wget ${DEP_SITE}/${ISL_FILE}; \
+ echo "${ISL_HASH} ${ISL_FILE}" | sha256sum -c
+
+FROM fetch as build
+RUN tar -xf ${SRC_FILE}
+WORKDIR gcc-${VERSION}
+RUN set -eux; \
+ mv ../*.tar.* .; \
./contrib/download_prerequisites; \
- { rm *.tar.* || true; }
-
-RUN set -ex; \
./configure \
--target=x86_64-linux-musl \
--build=x86_64-linux-musl \
--host=x86_64-linux-musl \
- --prefix /usr \
+ --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--libdir=/usr/lib \
@@ -36,13 +55,23 @@ RUN set -ex; \
--enable-languages=c,c++ \
--enable-link-serialization=2 \
--enable-linker-build-id; \
- make -j "$(nproc)"
-RUN set -eux; \
+ make -j "$(nproc)"; \
make DESTDIR=/home/user/rootfs/ install-strip; \
ln -s gcc /home/user/rootfs/usr/bin/cc
COPY --from=musl /lib/* /home/user/rootfs/lib/
-FROM scratch
+FROM ${REGISTRY}/binutils:latest as binutils
+FROM scratch as test
+COPY --from=busybox . /
+COPY --from=binutils . /
+COPY --from=musl . /
+COPY --from=build /home/user/rootfs /
+ADD test.c .
+RUN set -eux; \
+ gcc test.c -static -o main; \
+ ./main | grep "Success"
+
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/gcc"]
CMD ["--version"]
diff --git a/tests/c/main.c b/gcc/test.c
similarity index 100%
rename from tests/c/main.c
rename to gcc/test.c
diff --git a/go/Dockerfile b/go/Dockerfile
index 35061f0..295fda1 100644
--- a/go/Dockerfile
+++ b/go/Dockerfile
@@ -85,7 +85,7 @@ RUN set -eux; \
mkdir -p ${DEST}; \
cp -R bin lib pkg src ${DEST}
-FROM scratch
+FROM scratch as package
COPY --from=stage3 /home/user/go-stage3 /
USER 100:100
ENTRYPOINT ["/bin/go"]
diff --git a/libtool/Dockerfile b/libtool/Dockerfile
index 92ed0ca..d1e6151 100644
--- a/libtool/Dockerfile
+++ b/libtool/Dockerfile
@@ -29,9 +29,9 @@ RUN make DESTDIR=/home/user/rootfs install
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
COPY --from=bash . /home/user/rootfs
COPY --from=sed . /home/user/rootfs
-RUN ln -s /usr/bin/bash /home/user/rootfs/bin/sh
+RUN ln -s /bin/bash /home/user/rootfs/bin/sh
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/libtool"]
CMD ["--version"]
diff --git a/libunwind/Dockerfile b/libunwind/Dockerfile
index f0faf65..26e7cec 100644
--- a/libunwind/Dockerfile
+++ b/libunwind/Dockerfile
@@ -1,12 +1,12 @@
ARG REGISTRY=local
-FROM ${REGISTRY}/busybox:latest as busybox
-FROM ${REGISTRY}/gcc:latest as gcc
-FROM ${REGISTRY}/binutils:latest as binutils
-FROM ${REGISTRY}/musl:latest as musl
-FROM ${REGISTRY}/make:latest as make
-FROM ${REGISTRY}/autoconf:latest as autoconf
-FROM ${REGISTRY}/automake:latest as automake
-FROM ${REGISTRY}/libtool:latest as libtool
+FROM ${REGISTRY}/busybox as busybox
+FROM ${REGISTRY}/gcc as gcc
+FROM ${REGISTRY}/binutils as binutils
+FROM ${REGISTRY}/musl as musl
+FROM ${REGISTRY}/make as make
+FROM ${REGISTRY}/autoconf as autoconf
+FROM ${REGISTRY}/automake as automake
+FROM ${REGISTRY}/libtool as libtool
FROM busybox as build
ENV SRC_SITE=https://github.com/libunwind/libunwind/releases/download
@@ -17,13 +17,12 @@ RUN echo "${SRC_HASH} libunwind-${SRC_VERSION}.tar.gz" | sha256sum -c
RUN tar -xf libunwind-${SRC_VERSION}.tar.gz
WORKDIR libunwind-${SRC_VERSION}
COPY --from=gcc . /
-COPY --from=binutils . /
COPY --from=make . /
COPY --from=musl . /
+COPY --from=binutils . /
COPY --from=autoconf . /
COPY --from=automake . /
COPY --from=libtool . /
-#LDFLAGS="-lucontext" CFLAGS="-fno-stack-protector" \
RUN set -eux; \
./configure \
--build=x86_64-unknown-linux-musl \
@@ -34,9 +33,9 @@ RUN set -eux; \
--localstatedir=/usr/share/man \
--enable-cxx-exceptions \
--disable-tests \
- --infodir=/usr/share/info; \
+ --infodir=/usr/share/info || cat config.log; \
make;
RUN make DESTDIR=/home/user/rootfs install
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
diff --git a/libxml2/Dockerfile b/libxml2/Dockerfile
index 5c96d36..a3af69b 100644
--- a/libxml2/Dockerfile
+++ b/libxml2/Dockerfile
@@ -44,5 +44,5 @@ RUN set -eux; \
RUN make DESTDIR=/home/user/rootfs install
RUN ls -Rlah /home/user/rootfs
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
diff --git a/linux-headers/Dockerfile b/linux-headers/Dockerfile
index 56d9acd..edd4cee 100644
--- a/linux-headers/Dockerfile
+++ b/linux-headers/Dockerfile
@@ -17,5 +17,5 @@ RUN set -ex; \
find /rootfs/usr/include/ ! -iname "*.h" -type f -exec rm -v {} \+; \
rm -rf /rootfs/usr/include/drm;
-FROM scratch
+FROM scratch as package
COPY --from=build /rootfs /
diff --git a/llvm/Dockerfile b/llvm/Dockerfile
index 24863f9..fb586c7 100644
--- a/llvm/Dockerfile
+++ b/llvm/Dockerfile
@@ -1,23 +1,24 @@
ARG REGISTRY=local
-FROM ${REGISTRY}/busybox:latest as busybox
-FROM ${REGISTRY}/gcc:latest as gcc
-FROM ${REGISTRY}/binutils:latest as binutils
-FROM ${REGISTRY}/musl:latest as musl
-FROM ${REGISTRY}/openssl:latest as openssl
-FROM ${REGISTRY}/python:latest as python
-FROM ${REGISTRY}/py-setuptools:latest as py-setuptools
-FROM ${REGISTRY}/cmake:latest as cmake
-FROM ${REGISTRY}/ninja:latest as ninja
+FROM ${REGISTRY}/busybox as busybox
+FROM ${REGISTRY}/gcc as gcc
+FROM ${REGISTRY}/binutils as binutils
+FROM ${REGISTRY}/musl as musl
+FROM ${REGISTRY}/openssl as openssl
+FROM ${REGISTRY}/python as python
+FROM ${REGISTRY}/py-setuptools as py-setuptools
+FROM ${REGISTRY}/cmake as cmake
+FROM ${REGISTRY}/ninja as ninja
FROM busybox as build
+ARG VERSION=16.0.6
+ENV SRC_VERSION=${VERSION}
ENV SRC_SITE=https://github.com/llvm/llvm-project/releases/download
-ENV SRC_VERSION=16.0.6
-ENV SRC_HASH=ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e
+ENV SRC_HASH_13_0_1=326335a830f2e32d06d0a36393b5455d17dc73e0bd1211065227ee014f92cbf8
+ENV SRC_HASH_16_0_6=ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e
RUN wget ${SRC_SITE}/llvmorg-${SRC_VERSION}/llvm-project-${SRC_VERSION}.src.tar.xz
-RUN echo "${SRC_HASH} llvm-project-${SRC_VERSION}.src.tar.xz" | sha256sum -c
+RUN echo "$(printenv SRC_HASH_${VERSION//./_}) llvm-project-${SRC_VERSION}.src.tar.xz" | sha256sum -c
RUN tar -xf llvm-project-${SRC_VERSION}.src.tar.xz
WORKDIR llvm-project-${SRC_VERSION}.src
-RUN ls -lah .
ADD . .
RUN patch -p1 < rust-feature-tables.patch
COPY --from=binutils . /
@@ -49,7 +50,7 @@ RUN set -eux; \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_DUMP=ON \
-DLLVM_ENABLE_EH=ON \
- -DLLVM_ENABLE_FFI=ON \
+ -DLLVM_ENABLE_FFI=OFF \
-DLLVM_ENABLE_LIBCXX=OFF \
-DLLVM_ENABLE_LIBEDIT=OFF \
-DLLVM_ENABLE_PIC=ON \
@@ -75,7 +76,7 @@ COPY --from=musl /lib/* /home/user/rootfs/lib/
COPY --from=gcc /usr/lib/* /home/user/rootfs/usr/lib/
COPY --from=gcc /usr/lib64/* /home/user/rootfs/usr/lib/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/llc"]
diff --git a/llvm13/Dockerfile b/llvm13/Dockerfile
deleted file mode 100644
index a8e1c87..0000000
--- a/llvm13/Dockerfile
+++ /dev/null
@@ -1,82 +0,0 @@
-ARG REGISTRY=local
-FROM ${REGISTRY}/busybox:latest as busybox
-FROM ${REGISTRY}/gcc:latest as gcc
-FROM ${REGISTRY}/binutils:latest as binutils
-FROM ${REGISTRY}/musl:latest as musl
-FROM ${REGISTRY}/openssl:latest as openssl
-FROM ${REGISTRY}/python:latest as python
-FROM ${REGISTRY}/py-setuptools:latest as py-setuptools
-FROM ${REGISTRY}/cmake:latest as cmake
-FROM ${REGISTRY}/ninja:latest as ninja
-
-FROM busybox as build
-ENV SRC_SITE=https://github.com/llvm/llvm-project/releases/download
-ENV SRC_VERSION=13.0.1
-ENV SRC_HASH=326335a830f2e32d06d0a36393b5455d17dc73e0bd1211065227ee014f92cbf8
-RUN wget ${SRC_SITE}/llvmorg-${SRC_VERSION}/llvm-project-${SRC_VERSION}.src.tar.xz
-RUN echo "${SRC_HASH} llvm-project-${SRC_VERSION}.src.tar.xz" | sha256sum -c
-RUN tar -xf llvm-project-${SRC_VERSION}.src.tar.xz
-WORKDIR llvm-project-${SRC_VERSION}.src
-RUN ls -lah .
-ADD . .
-RUN patch -p1 < rust-feature-tables.patch
-COPY --from=binutils . /
-COPY --from=cmake . /
-COPY --from=ninja . /
-COPY --from=musl . /
-COPY --from=gcc . /
-COPY --from=python . /
-COPY --from=py-setuptools . /
-
-RUN set -eux; \
- python -c "import setuptools; print(setuptools.__version__)"; \
- cmake \
- -B build \
- -G Ninja \
- -Wno-dev -S llvm \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr/ \
- -DCMAKE_INSTALL_RPATH=/usr/ \
- -DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-linux-musl" \
- -DLLVM_HOST_TRIPLE="x86_64-linux-musl" \
- -DLLVM_APPEND_VC_REV=OFF \
- -DLLVM_BINUTILS_INCDIR=/usr/include \
- -DLLVM_BUILD_DOCS=OFF \
- -DLLVM_BUILD_EXAMPLES=OFF \
- -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
- -DLLVM_BUILD_TESTS=ON \
- -DLLVM_ENABLE_ASSERTIONS=OFF \
- -DLLVM_ENABLE_DUMP=ON \
- -DLLVM_ENABLE_EH=ON \
- -DLLVM_ENABLE_FFI=OFF \
- -DLLVM_ENABLE_LIBCXX=OFF \
- -DLLVM_ENABLE_LIBEDIT=OFF \
- -DLLVM_ENABLE_PIC=ON \
- -DLLVM_ENABLE_RTTI=ON \
- -DLLVM_ENABLE_SPHINX=OFF \
- -DLLVM_ENABLE_TERMINFO=ON \
- -DLLVM_ENABLE_ZLIB=OFF \
- -DLLVM_ENABLE_ZSTD=OFF \
- -DLLVM_INCLUDE_BENCHMARKS=OFF \
- -DLLVM_INCLUDE_EXAMPLES=OFF \
- -DLLVM_INSTALL_UTILS=ON \
- -DLLVM_LINK_LLVM_DYLIB=ON \
- -DLLVM_USE_PERF=ON; \
- cmake --build build; \
- python3 llvm/utils/lit/setup.py build
-
-RUN set -eux; \
- export DESTDIR="/home/user/rootfs/"; \
- cmake --install build; \
- python3 llvm/utils/lit/setup.py install --root="$DESTDIR"
-
-COPY --from=musl /lib/* /home/user/rootfs/lib/
-COPY --from=gcc /usr/lib/* /home/user/rootfs/usr/lib/
-COPY --from=gcc /usr/lib64/* /home/user/rootfs/usr/lib/
-
-FROM scratch
-COPY --from=build /home/user/rootfs /
-USER 100:100
-ENTRYPOINT ["/usr/bin/llc"]
-CMD ["--version"]
diff --git a/llvm13/rust-feature-tables.patch b/llvm13/rust-feature-tables.patch
deleted file mode 100644
index 42fa8f4..0000000
--- a/llvm13/rust-feature-tables.patch
+++ /dev/null
@@ -1,305 +0,0 @@
-
-
-
-rust-feature-tables.patch « llvm16 « main - aports - Alpine packages build scripts
-
-
-
-
-
-
-
-
-
-
-
-
-
blob: 2068d51f2b9aae67132d65eb83489b22c9d227c4 (
plain)
-
-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
- |
-Patch-Source: https://github.com/rust-lang/llvm-project/commit/0a157fd7a5f61973ffddf96b3d445a718193eb1a
-From 0a157fd7a5f61973ffddf96b3d445a718193eb1a Mon Sep 17 00:00:00 2001
-From: Cameron Hart <cameron.hart@gmail.com>
-Date: Sun, 10 Jul 2016 23:55:53 +1000
-Subject: [PATCH] [rust] Add accessors for MCSubtargetInfo CPU and Feature
- tables
-
-This is needed for `-C target-cpu=help` and `-C target-feature=help` in rustc
----
- llvm/include/llvm/MC/MCSubtargetInfo.h | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h
-index e1f0a86141e36..1e529bf4fb31e 100644
---- a/llvm/include/llvm/MC/MCSubtargetInfo.h
-+++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
-@@ -230,6 +230,14 @@ class MCSubtargetInfo {
- return Found != ProcDesc.end() && StringRef(Found->Key) == CPU;
- }
-
-+ ArrayRef<SubtargetSubTypeKV> getCPUTable() const {
-+ return ProcDesc;
-+ }
-+
-+ ArrayRef<SubtargetFeatureKV> getFeatureTable() const {
-+ return ProcFeatures;
-+ }
-+
- virtual unsigned getHwMode() const { return 0; }
-
- /// Return the cache size in bytes for the given level of cache.
-
-
|
-
-
-
-
-
diff --git a/m4/Dockerfile b/m4/Dockerfile
index 74d4041..0965807 100644
--- a/m4/Dockerfile
+++ b/m4/Dockerfile
@@ -25,7 +25,7 @@ RUN set -eux; \
RUN make DESTDIR=/home/user/rootfs install
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/m4"]
CMD ["--version"]
diff --git a/make/Dockerfile b/make/Dockerfile
index 4e581e4..42cc186 100644
--- a/make/Dockerfile
+++ b/make/Dockerfile
@@ -23,7 +23,7 @@ RUN set -ex; \
make DESTDIR="/rootfs" install;
COPY --from=musl /usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /rootfs /
ENTRYPOINT ["/usr/bin/make"]
CMD ["--version"]
diff --git a/musl/Dockerfile b/musl/Dockerfile
index f101424..0009c2d 100644
--- a/musl/Dockerfile
+++ b/musl/Dockerfile
@@ -38,5 +38,5 @@ RUN set -eux; \
ln -sf ld-musl-x86_64.so.1 /home/user/rootfs/lib/libc.musl-x86_64.so.1; \
ln -sf ../../lib/ld-musl-x86_64.so.1 /home/user/rootfs/usr/lib/libc.so;
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
diff --git a/ninja/Dockerfile b/ninja/Dockerfile
index eee2ff0..fda25d8 100644
--- a/ninja/Dockerfile
+++ b/ninja/Dockerfile
@@ -35,7 +35,7 @@ RUN set -eux; \
COPY --from=gcc /usr/lib64/* /home/user/rootfs/usr/lib/
COPY --from=musl . /home/user/rootfs/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/ninja"]
diff --git a/openssl/Dockerfile b/openssl/Dockerfile
index fed828a..10714c6 100644
--- a/openssl/Dockerfile
+++ b/openssl/Dockerfile
@@ -44,7 +44,7 @@ RUN set -eux; \
make; \
make DESTDIR=/home/user/rootfs install
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/openssl"]
diff --git a/perl/Dockerfile b/perl/Dockerfile
index 88a193b..5746eb2 100644
--- a/perl/Dockerfile
+++ b/perl/Dockerfile
@@ -49,7 +49,7 @@ RUN set -eux; \
make DESTDIR=/home/user/rootfs install
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/perl"]
diff --git a/pkgconf/Dockerfile b/pkgconf/Dockerfile
index dc647af..b4066e5 100644
--- a/pkgconf/Dockerfile
+++ b/pkgconf/Dockerfile
@@ -25,7 +25,7 @@ RUN make DESTDIR=/home/user/rootfs install
RUN ln -s pkgconf /home/user/rootfs/usr/bin/pkg-config
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/usr/bin/pkgconf"]
CMD ["--version"]
diff --git a/py-setuptools/Dockerfile b/py-setuptools/Dockerfile
index 007f6eb..918b236 100644
--- a/py-setuptools/Dockerfile
+++ b/py-setuptools/Dockerfile
@@ -16,5 +16,5 @@ RUN set -eux; \
python3 setup.py install --root=/home/user/rootfs; \
ls -Rlah /home/user/rootfs
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
diff --git a/python/Dockerfile b/python/Dockerfile
index 1b34548..c4d3f79 100644
--- a/python/Dockerfile
+++ b/python/Dockerfile
@@ -35,7 +35,7 @@ RUN set -eux; \
RUN ln -s /usr/bin/python3 /home/user/rootfs/usr/bin/python
COPY --from=musl . /home/user/rootfs/
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/python"]
diff --git a/sed/Dockerfile b/sed/Dockerfile
index 5fcd938..e449b72 100644
--- a/sed/Dockerfile
+++ b/sed/Dockerfile
@@ -1,4 +1,4 @@
-REGISTRY=local
+ARG REGISTRY=local
FROM ${REGISTRY}/busybox:latest as busybox
FROM ${REGISTRY}/gcc:latest as gcc
FROM ${REGISTRY}/binutils:latest as binutils
@@ -25,7 +25,7 @@ RUN set -eux; \
RUN make DESTDIR=/home/user/rootfs install
COPY --from=musl /usr/lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /
ENTRYPOINT ["/bin/sed"]
CMD ["--version"]
diff --git a/tests/c/Dockerfile b/tests/c/Dockerfile
deleted file mode 100644
index 99b8c45..0000000
--- a/tests/c/Dockerfile
+++ /dev/null
@@ -1,16 +0,0 @@
-FROM ocirep/busybox as build
-COPY --from=ocirep/gcc . /
-COPY --from=ocirep/musl . /
-COPY --from=ocirep/binutils . /
-COPY . .
-RUN set -eux; \
- gcc main.c -static -o main; \
- mkdir -p $HOME/rootfs/etc; \
- echo "nogroup:*:100:nobody" > ~/rootfs/etc/group; \
- echo "nobody:*:100:100:::" > ~/rootfs/etc/passwd; \
- cp main $HOME/rootfs/
-
-FROM scratch
-COPY --from=build --chown=100:100 /home/user/rootfs /
-USER 100:100
-ENTRYPOINT ["/main"]
diff --git a/zlib/Dockerfile b/zlib/Dockerfile
index 87b0801..95056dc 100644
--- a/zlib/Dockerfile
+++ b/zlib/Dockerfile
@@ -25,5 +25,5 @@ RUN set -eux; \
make;
RUN make DESTDIR=/home/user/rootfs install
-FROM scratch
+FROM scratch as package
COPY --from=build /home/user/rootfs /