stargazing/notwa-util/Dockerfile

41 lines
1.5 KiB
Docker

# MAIN: https://eaguru.guru/git/notwa/stargazing
# REPO: https://eaguru.guru/git/notwa/stargazing
FROM docker.io/library/alpine:3.16 as partial
# need this for acquire (.tar.xz files):
RUN apk add --no-cache xz
COPY --chmod=0755 acquire cosmocc dedupe ofc quickconf shed \
/usr/local/bin/
RUN ln -s /usr/local/bin /nu
WORKDIR /media/common
FROM partial as downloader
# this demonstrates how to use the `acquire` script.
ARG BUSYBOX_VERSION=1.35.0
ARG BUSYBOX_SHA256=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
--mount=type=tmpfs,target=/tmp : \
&& name=busybox \
&& remote_fn="$name-$BUSYBOX_VERSION.tar.bz2" \
&& export local_fn="$remote_fn" \
&& export remote_url="http://busybox.net/downloads/$remote_fn" \
&& export dest=/root/$name \
&& export sha256="$BUSYBOX_SHA256" \
&& acquire \
;
FROM docker.io/library/alpine:3.16 as builder
RUN apk add --no-cache gcc linux-headers make musl-dev
# configure and build a rescue shell and some utilities,
# i.e. one better suited for images built "FROM scratch".
# this can greatly differ from Alpine's build of busybox.
# for one thing, this build is half the size of Alpine's.
# this binary is *not* an APE; it's only for Linux hosts.
# TODO: inherit security patches from Alpine.
COPY --from=downloader /root /root
WORKDIR /root/busybox
COPY busybox.config .config
RUN make -j2 && du -h busybox
FROM partial as final
COPY --chmod=0755 --from=builder /root/busybox/busybox /usr/local/bin/busybox