From 9efa0cf20d1f1ac5bbaa8d69add082e34dd391e4 Mon Sep 17 00:00:00 2001 From: fithwum Date: Sun, 13 Jul 2025 17:34:27 -0700 Subject: [PATCH] sdfhdsfhgsdfghfsgdh --- Dockerfile | 96 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd168c8..5f11d16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,80 @@ -FROM alpine:latest AS builder -LABEL maintainer="fithwum" +# FROM alpine:latest AS builder +# LABEL maintainer="fithwum" -ARG ALPINE_VERSION -ENV ALPINE_VERSION=${ALPINE_VERSION} +# ARG ALPINE_VERSION +# ENV ALPINE_VERSION=${ALPINE_VERSION} + +# WORKDIR /builder + +# # Install tools needed for building rootfs +# RUN apk update && apk add --no-cache bash curl wget git jq ca-certificates coreutils tar gzip + +# # Download alpine-make-rootfs script +# RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master/alpine-make-rootfs \ +# && chmod +x alpine-make-rootfs + +# # Build the rootfs +# RUN ./alpine-make-rootfs \ +# --branch ${ALPINE_VERSION} \ +# --mirror http://dl-cdn.alpinelinux.org/alpine/ \ +# --packages "bash curl ca-certificates nano" \ +# alpine-rootfs + +# # Run custom script inside rootfs +# COPY base-image-script/alpine-base_pt2.sh /builder/alpine-rootfs/ +# RUN chmod +x /builder/alpine-rootfs/alpine-base_pt2.sh && \ +# chroot /builder/alpine-rootfs /alpine-base_pt2.sh || true + +# # Clean up script +# RUN rm -f /builder/alpine-rootfs/alpine-base_pt2.sh + +# # Package with versioned filename +# RUN mkdir -p /output && \ +# tar -czf /output/alpine-${ALPINE_VERSION}.tar.gz -C alpine-rootfs . + +# # Final stage just copies the archive +# FROM scratch AS export-stage +# ARG ALPINE_VERSION +# COPY --from=builder /output/alpine-${ALPINE_VERSION}.tar.gz /output/alpine-${ALPINE_VERSION}.tar.gz +# CMD ["sleep", "infinity"] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +FROM alpine:3.20 AS builder +LABEL maintainer="fithwum" WORKDIR /builder # Install tools needed for building rootfs -RUN apk update && apk add --no-cache bash curl wget git jq ca-certificates coreutils tar gzip +RUN apk update && apk add --no-cache \ + bash curl wget git jq ca-certificates coreutils \ + tar gzip # Download alpine-make-rootfs script RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master/alpine-make-rootfs \ @@ -15,25 +82,24 @@ RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master # Build the rootfs RUN ./alpine-make-rootfs \ - --branch ${ALPINE_VERSION} \ - --mirror http://dl-cdn.alpinelinux.org/alpine/ \ + --branch v3.20 \ + --mirror http://dl-cdn.alpinelinux.org/alpine \ --packages "bash curl ca-certificates nano" \ alpine-rootfs -# Run custom script inside rootfs +# Run custom script inside rootfs without chroot (simulate setup) COPY base-image-script/alpine-base_pt2.sh /builder/alpine-rootfs/ RUN chmod +x /builder/alpine-rootfs/alpine-base_pt2.sh && \ chroot /builder/alpine-rootfs /alpine-base_pt2.sh || true -# Clean up script +# Clean up the part2 script after execution RUN rm -f /builder/alpine-rootfs/alpine-base_pt2.sh -# Package with versioned filename +# Package it RUN mkdir -p /output && \ - tar -czf /output/alpine-${ALPINE_VERSION}.tar.gz -C alpine-rootfs . + tar -czf /output/alpine-base.tar.gz -C alpine-rootfs . -# Final stage just copies the archive +# Final image to export tarball FROM scratch AS export-stage -ARG ALPINE_VERSION -COPY --from=builder /output/alpine-${ALPINE_VERSION}.tar.gz /output/alpine-${ALPINE_VERSION}.tar.gz -CMD ["sleep", "infinity"] +COPY --from=builder /output/alpine-base.tar.gz /output/alpine-base.tar.gz +CMD ["sleep", "infinity"] \ No newline at end of file