add initial bash and busybox

This commit is contained in:
Lance Vick 2023-11-09 02:13:20 -08:00
parent 9a45e17e58
commit cd7c50e79e
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
3 changed files with 90 additions and 0 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
out/gcc.oci.tgz:
docker build -f packages/gcc/Dockerfile -t ocirep/gcc .
out/bash.oci.tgz:
docker build -f packages/bash/Dockerfile -t ocirep/bash .
out/busybox.oci.tgz:
docker build -f packages/busybox/Dockerfile -t ocirep/busybox .
out/go.oci.tgz:
docker build -f packages/go/Dockerfile -t ocirep/go .

16
packages/bash/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
ARG GCC_IMAGE=library/gcc@sha256:ca38f292fe1ad0933f0122a657f9c644ed1f0a9e1aa336abcc83d420ad487e28
FROM ${GCC_IMAGE} as build
ENV SOURCE_SITE=https://ftp.gnu.org/gnu/bash
ENV SOURCE_VERSION=5.2.15
ENV SOURCE_HASH=13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c
RUN wget ${SOURCE_SITE}/bash-${SOURCE_VERSION}.tar.gz
RUN echo "${SOURCE_HASH} bash-${SOURCE_VERSION}.tar.gz" | sha256sum -c
RUN tar -xzf bash-${SOURCE_VERSION}.tar.gz
RUN \
cd bash-${SOURCE_VERSION} \
&& ./configure --enable-static-link \
&& make install
FROM scratch
COPY --from=build /usr/local/bin/bash /

View File

@ -0,0 +1,63 @@
ARG GCC_IMAGE=library/gcc@sha256:ca38f292fe1ad0933f0122a657f9c644ed1f0a9e1aa336abcc83d420ad487e28
FROM ${GCC_IMAGE} as build
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
RUN cp ./busybox /
FROM scratch
COPY --from=build /busybox .
RUN ["/busybox","mkdir","/bin"]
RUN ["/busybox","--install","-s","/bin"]
RUN echo "nogroup:*:100:nobody" > /etc/group
RUN echo "nobody:*:100:100:::" > /etc/passwd
RUN mkdir /tmp
RUN chown -R 100:100 /tmp
WORKDIR /tmp
USER 100:100
ENTRYPOINT ["/bin/sh"]