2023-11-13 22:48:02 +00:00
|
|
|
FROM ocirep/bootstrap as bootstrap
|
2023-11-09 10:13:20 +00:00
|
|
|
|
2023-11-13 22:48:02 +00:00
|
|
|
FROM bootstrap as build
|
2023-11-09 10:13:20 +00:00
|
|
|
ENV SOURCE_SITE=https://busybox.net/downloads
|
|
|
|
ENV SOURCE_VERSION=1.36.1
|
|
|
|
ENV SOURCE_HASH=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314
|
|
|
|
RUN wget ${SOURCE_SITE}/busybox-${SOURCE_VERSION}.tar.bz2
|
|
|
|
RUN echo "${SOURCE_HASH} busybox-${SOURCE_VERSION}.tar.bz2" | sha256sum -c
|
|
|
|
RUN tar -xjf busybox-${SOURCE_VERSION}.tar.bz2
|
|
|
|
WORKDIR busybox-${SOURCE_VERSION}
|
|
|
|
RUN set -eux; \
|
|
|
|
setConfs=' \
|
|
|
|
CONFIG_AR=y \
|
|
|
|
CONFIG_FEATURE_AR_CREATE=y \
|
|
|
|
CONFIG_FEATURE_AR_LONG_FILENAMES=y \
|
|
|
|
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
|
|
|
|
|
|
|
|
RUN make
|
2023-11-09 12:14:02 +00:00
|
|
|
RUN cp busybox /
|
2023-11-09 10:13:20 +00:00
|
|
|
|
|
|
|
FROM scratch
|
2023-11-09 12:14:02 +00:00
|
|
|
COPY --from=build busybox /
|
2023-11-09 10:13:20 +00:00
|
|
|
RUN ["/busybox","mkdir","/bin"]
|
|
|
|
RUN ["/busybox","--install","-s","/bin"]
|
2023-11-09 12:14:02 +00:00
|
|
|
RUN echo "user:x:1000:" > /etc/group
|
|
|
|
RUN echo "user:x:1000:1000::/home/user:/bin/sh" > /etc/passwd
|
|
|
|
RUN mkdir -p /home/user /tmp /lib
|
|
|
|
RUN ln -sT /lib /lib64
|
|
|
|
RUN chown -R 1000:1000 /home/user /tmp
|
|
|
|
WORKDIR /home/user
|
|
|
|
USER 1000:1000
|
2023-11-09 10:13:20 +00:00
|
|
|
ENTRYPOINT ["/bin/sh"]
|