2023-12-12 17:45:39 +00:00
|
|
|
ARG REGISTRY=local
|
2023-12-10 18:05:50 +00:00
|
|
|
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}/bash:latest as bash
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM ${REGISTRY}/busybox:latest as busybox
|
2023-12-05 04:34:07 +00:00
|
|
|
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM busybox as base
|
2023-12-05 04:34:07 +00:00
|
|
|
ENV SRC_SITE=https://ftp.gnu.org/gnu/sed
|
|
|
|
ENV SRC_VERSION=4.9
|
|
|
|
ENV SRC_HASH=6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181
|
|
|
|
COPY --from=gcc . /
|
|
|
|
COPY --from=binutils . /
|
|
|
|
COPY --from=make . /
|
|
|
|
COPY --from=musl . /
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
FROM base as fetch
|
|
|
|
RUN wget ${SRC_SITE}/sed-${SRC_VERSION}.tar.xz
|
|
|
|
RUN echo "${SRC_HASH} sed-${SRC_VERSION}.tar.xz" | sha256sum -c
|
|
|
|
|
|
|
|
FROM fetch as build
|
|
|
|
RUN tar -xf sed-${SRC_VERSION}.tar.xz
|
|
|
|
WORKDIR sed-${SRC_VERSION}
|
2023-12-05 04:34:07 +00:00
|
|
|
RUN set -eux; \
|
|
|
|
./configure \
|
|
|
|
--prefix=/; \
|
2023-12-16 23:50:40 +00:00
|
|
|
make
|
|
|
|
|
|
|
|
FROM build as install
|
|
|
|
USER 0:0
|
|
|
|
RUN make DESTDIR=/rootfs install
|
|
|
|
COPY --from=musl /usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1
|
|
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
2023-12-05 04:34:07 +00:00
|
|
|
|
2023-12-12 17:45:39 +00:00
|
|
|
FROM scratch as package
|
2023-12-16 23:50:40 +00:00
|
|
|
COPY --from=install /rootfs /
|
2023-12-05 04:34:07 +00:00
|
|
|
ENTRYPOINT ["/bin/sed"]
|
|
|
|
CMD ["--version"]
|