musl, and musl-linked scratch gcc image

This commit is contained in:
Lance Vick 2023-11-12 22:09:30 -08:00
parent 38e6e8ec2a
commit 445468954a
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
4 changed files with 30 additions and 4 deletions

View File

@ -3,6 +3,10 @@ export SOURCE_DATE_EPOCH = 0
out/bootstrap.oci.tgz:
docker build -t ocirep/bootstrap --output type=oci,dest=$@ packages/bootstrap
out/musl.oci.tgz: \
out/musl.oci.tgz
docker build -t ocirep/musl --output type=oci,dest=$@ packages/musl
out/gcc.oci.tgz: \
out/bootstrap.oci.tgz
docker build -t ocirep/gcc --output type=oci,dest=$@ packages/gcc

View File

@ -1,5 +1,5 @@
FROM buildpack-deps@sha256:8465175ca53f8f2e756d069658b3f353bb3732926b1f33f34332cfbf597ad0c0 as build
FROM alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends flex
apk update; \
apk add gcc g++ libc-dev make linux-headers

View File

@ -1,3 +1,4 @@
FROM ocirep/musl:latest as musl
FROM ocirep/bootstrap:latest as build
ENV GCC_SITE https://mirrors.kernel.org/gnu/gcc
@ -11,15 +12,19 @@ WORKDIR gcc-${GCC_VERSION}
RUN set -ex; \
./contrib/download_prerequisites; \
{ rm *.tar.* || true; }
RUN set -ex; \
./configure \
--build="x86_64-linux-gnu" \
--build="x86_64-linux-musl" \
--host="x86_64-linux-musl" \
--disable-multilib \
--enable-languages=c,c++ \
--prefix /rootfs \
; \
make -j "$(nproc)"; \
make install-strip
COPY --from=musl /lib /libmusl
RUN mv /libmusl/* /rootfs/lib/
FROM scratch
COPY --from=build /rootfs /

17
packages/musl/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ocirep/bootstrap:latest as build
ENV SRC_SITE http://musl.libc.org
ENV SRC_VERSION 1.2.4
ENV SRC_HASH 7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039
RUN wget ${SRC_SITE}/releases/musl-$SRC_VERSION.tar.gz
RUN echo "${SRC_HASH} musl-${SRC_VERSION}.tar.gz" | sha256sum -c
RUN tar -xzf musl-${SRC_VERSION}.tar.gz
WORKDIR musl-${SRC_VERSION}
RUN set -ex; \
./configure \
--prefix=/; \
make DESTDIR=/rootfs install;
FROM scratch
COPY --from=build /rootfs /