From 4bba99f4f2bf1a3f34cd8d9c67983ec80434cb06 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 19 Jan 2024 10:15:25 -0600 Subject: [PATCH] Rebase on Alpine Using Alpine instead of Fedora Minimal reduces the size of the final image from 175 MB to 50 MB. This should speed up execeution on slow machines like Raspberry Pis. --- Containerfile | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/Containerfile b/Containerfile index 3d75887..e106399 100644 --- a/Containerfile +++ b/Containerfile @@ -1,40 +1,21 @@ -FROM registry.fedoraproject.org/fedora-minimal:39 AS build - -ARG CUE_VERSION=0.7.0 +FROM docker.io/library/alpine:3.19 RUN --mount=type=cache,target=/var/cache \ - microdnf install -y \ - --setopt install_weak_deps=0 \ - gzip \ - tar \ - && ARCH=$(uname -m) \ - && case "${ARCH}" in \ - x86_64) ARCH=amd64 ;; \ - aarch64) ARCH=arm64 ;; \ - esac \ - && url="https://github.com/cue-lang/cue/releases/download/v${CUE_VERSION}/cue_v${CUE_VERSION}_linux_${ARCH}.tar.gz" \ - && curl -fsSL "${url}" \ - | tar -C /usr/local/bin -xz cue \ - && : - - -FROM git.pyrocufflink.net/containerimages/tmpl - -RUN --mount=type=cache,target=/var/cache \ - --mount=type=bind,from=build,source=/,target=/build \ - microdnf install -y \ - --setopt install_weak_deps=0 \ + apk add \ age \ - git-core \ + git \ && ln -snf /host/etc/passwd /etc/passwd \ && ln -snf /host/etc/group /etc/group \ - && cp -a /build/usr/local/bin/cue /usr/local/bin/ \ && for cmd in \ systemctl \ systemd-sysusers \ ; do ln -s nsenter.sh /usr/local/bin/${cmd}; done \ && : +COPY --from=docker.io/cuelang/cue:0.7.0 /usr/bin/cue /usr/local/bin/cue + +COPY --from=git.pyrocufflink.net/containerimages/tmpl /tmpl /usr/local/bin/tmpl + COPY nsenter.sh /usr/local/bin/nsenter.sh COPY config.sh / @@ -42,6 +23,3 @@ COPY config.sh / ENTRYPOINT [] CMD ["/config.sh"] - -LABEL license= \ - vendor='Dustin C. Hatch' \