2023-12-10 18:05:50 +00:00
|
|
|
ARG REGISTRY=local
|
2023-12-12 17:45:39 +00:00
|
|
|
from ${REGISTRY}/binutils as binutils
|
|
|
|
from ${REGISTRY}/gcc as gcc
|
|
|
|
from ${REGISTRY}/musl as musl
|
|
|
|
from ${REGISTRY}/make as make
|
2023-12-16 23:50:40 +00:00
|
|
|
from ${REGISTRY}/busybox as busybox
|
2023-11-09 10:13:20 +00:00
|
|
|
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM busybox as base
|
2023-12-12 17:45:39 +00:00
|
|
|
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 . /
|
2023-12-02 18:37:45 +00:00
|
|
|
RUN set -eux; \
|
2023-12-16 23:50:40 +00:00
|
|
|
mkdir -p /home/user/rootfs/lib; \
|
2023-12-02 18:37:45 +00:00
|
|
|
./configure \
|
2023-12-12 17:45:39 +00:00
|
|
|
--build=x86_64-unknown-linux-musl \
|
|
|
|
--host=x86_64-unknown-linux-musl \
|
2023-12-02 18:37:45 +00:00
|
|
|
--prefix=/usr \
|
2023-12-12 17:45:39 +00:00
|
|
|
--bindir=/bin \
|
|
|
|
--mandir=/usr/share/man \
|
|
|
|
--infodir=/usr/share/info \
|
|
|
|
--disable-nls \
|
|
|
|
--enable-readline \
|
|
|
|
--without-curses \
|
|
|
|
--without-bash-malloc; \
|
|
|
|
make
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
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-11-09 10:13:20 +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-12 17:45:39 +00:00
|
|
|
ENTRYPOINT ["/bin/bash"]
|
|
|
|
CMD ["--version"]
|