2024-02-09 07:30:28 +00:00
|
|
|
FROM scratch as base
|
|
|
|
ENV VERSION=1.36.1
|
2024-01-23 23:46:02 +00:00
|
|
|
ENV SRC_HASH=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314
|
2024-02-09 07:30:28 +00:00
|
|
|
ENV SRC_FILE=busybox-${VERSION}.tar.bz2
|
|
|
|
ENV SRC_SITE=https://busybox.net/downloads/${SRC_FILE}
|
2023-11-09 10:13:20 +00:00
|
|
|
|
2023-12-12 17:45:39 +00:00
|
|
|
FROM base as fetch
|
2024-02-09 07:30:28 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
2023-12-12 17:45:39 +00:00
|
|
|
|
|
|
|
FROM fetch as build
|
2024-02-09 07:30:28 +00:00
|
|
|
COPY --from=stage3 . /
|
2023-12-12 17:45:39 +00:00
|
|
|
RUN tar -xjf ${SRC_FILE}
|
2024-02-09 07:30:28 +00:00
|
|
|
WORKDIR busybox-${VERSION}
|
|
|
|
ENV KCONFIG_NOTIMESTAMP=1
|
|
|
|
RUN --network=none <<-EOF
|
|
|
|
set -eux
|
|
|
|
setConfs='
|
|
|
|
CONFIG_LAST_SUPPORTED_WCHAR=0
|
|
|
|
CONFIG_STATIC=y
|
|
|
|
'
|
|
|
|
unsetConfs='
|
|
|
|
CONFIG_FEATURE_SYNC_FANCY
|
|
|
|
CONFIG_FEATURE_HAVE_RPC
|
|
|
|
CONFIG_FEATURE_INETD_RPC
|
|
|
|
CONFIG_FEATURE_UTMP
|
|
|
|
CONFIG_FEATURE_WTMP
|
|
|
|
'
|
|
|
|
make defconfig
|
|
|
|
for conf in $unsetConfs; do
|
|
|
|
sed -i \
|
|
|
|
-e "s!^$conf=.*\$!# $conf is not set!" \
|
|
|
|
.config
|
|
|
|
done
|
|
|
|
for confV in $setConfs; do
|
|
|
|
conf="${confV%=*}"
|
|
|
|
sed -i \
|
|
|
|
-e "s!^$conf=.*\$!$confV!" \
|
|
|
|
-e "s!^# $conf is not set\$!$confV!" \
|
|
|
|
.config
|
|
|
|
if ! grep -q "^$confV\$" .config; then
|
|
|
|
echo "$confV" >> .config
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
make oldconfig
|
|
|
|
for conf in $unsetConfs; do
|
|
|
|
! grep -q "^$conf=" .config
|
|
|
|
done
|
|
|
|
for confV in $setConfs; do
|
|
|
|
grep -q "^$confV\$" .config
|
|
|
|
done
|
|
|
|
make
|
|
|
|
EOF
|
2023-11-09 10:13:20 +00:00
|
|
|
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM build as install
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN --network=none <<-EOF
|
|
|
|
set -eux
|
|
|
|
mkdir -p /rootfs/bin
|
|
|
|
cp busybox /rootfs/bin
|
|
|
|
cp busybox /bin
|
|
|
|
cd /rootfs
|
|
|
|
mkdir -p home/user var/tmp etc tmp lib bin
|
|
|
|
/bin/busybox --install -s bin
|
|
|
|
echo "user:x:1000:" > etc/group
|
|
|
|
echo "user:x:1000:1000::/home/user:/bin/sh" > etc/passwd
|
|
|
|
ln -sT /lib lib64
|
|
|
|
chown -R 1000:1000 /rootfs/home/user /rootfs/tmp /rootfs/var/tmp
|
|
|
|
EOF
|
2024-02-09 18:19:36 +00:00
|
|
|
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-11-09 12:14:02 +00:00
|
|
|
WORKDIR /home/user
|
|
|
|
USER 1000:1000
|
2023-11-09 10:13:20 +00:00
|
|
|
ENTRYPOINT ["/bin/sh"]
|
2023-12-12 17:45:39 +00:00
|
|
|
ENV TZ=UTC
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
ENV SOURCE_DATE_EPOCH=1
|
2023-12-16 23:50:40 +00:00
|
|
|
ENV KCONFIG_NOTIMESTAMP=1
|
2024-01-23 23:46:02 +00:00
|
|
|
ENV PS1="stage4 $ "
|