This repository has been archived on 2024-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
stagex/bash/Dockerfile

46 lines
1.2 KiB
Docker
Raw Normal View History

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-11-09 10:13:20 +00:00
2023-12-12 17:45:39 +00:00
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 \
2023-12-12 17:45:39 +00:00
--build=x86_64-unknown-linux-musl \
--host=x86_64-unknown-linux-musl \
--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
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
2023-11-09 10:13:20 +00:00
2023-12-12 17:45:39 +00:00
FROM scratch as package
COPY --from=build /home/user/rootfs /
2023-12-12 17:45:39 +00:00
ENTRYPOINT ["/bin/bash"]
CMD ["--version"]