test
Some checks failed
Build and Push Alpine RootFS and Docker Images / build-and-upload-rootfs (push) Failing after 5s
Build and Push Alpine RootFS and Docker Images / build-and-push-docker-images (push) Has been skipped
Build and Push Alpine RootFS and Docker Images / generate-changelogs (push) Has been skipped
Build and Push Alpine RootFS and Docker Images / generate-build-info (push) Has been skipped
Some checks failed
Build and Push Alpine RootFS and Docker Images / build-and-upload-rootfs (push) Failing after 5s
Build and Push Alpine RootFS and Docker Images / build-and-push-docker-images (push) Has been skipped
Build and Push Alpine RootFS and Docker Images / generate-changelogs (push) Has been skipped
Build and Push Alpine RootFS and Docker Images / generate-build-info (push) Has been skipped
This commit is contained in:
@@ -19,7 +19,6 @@ env:
|
|||||||
IMAGE_REPO: alpine-base
|
IMAGE_REPO: alpine-base
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build-and-upload-rootfs:
|
build-and-upload-rootfs:
|
||||||
runs-on: vm-docker-build2
|
runs-on: vm-docker-build2
|
||||||
steps:
|
steps:
|
||||||
@@ -35,7 +34,7 @@ jobs:
|
|||||||
|
|
||||||
mkdir -p output/$version
|
mkdir -p output/$version
|
||||||
cid=$(docker create alpine-builder:$version)
|
cid=$(docker create alpine-builder:$version)
|
||||||
docker cp "$cid":/output/alpine-rootfs.tar.gz output/$version/
|
docker cp "$cid":/output/alpine-${version}.tar.gz output/$version/
|
||||||
docker rm "$cid"
|
docker rm "$cid"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
for version in $ALPINE_VERSIONS; do
|
for version in $ALPINE_VERSIONS; do
|
||||||
mkdir -p upload-repo/$version
|
mkdir -p upload-repo/$version
|
||||||
cp output/$version/alpine-rootfs.tar.gz upload-repo/$version/
|
cp output/$version/alpine-$version.tar.gz upload-repo/$version/
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Commit and push updated archives
|
- name: Commit and push updated archives
|
||||||
@@ -57,7 +56,7 @@ jobs:
|
|||||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||||
|
|
||||||
if git status --porcelain | grep .; then
|
if git status --porcelain | grep .; then
|
||||||
git add */alpine-rootfs.tar.gz
|
git add */alpine-$version.tar.gz
|
||||||
git commit -m "Update Alpine rootfs $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
git commit -m "Update Alpine rootfs $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||||
git push
|
git push
|
||||||
else
|
else
|
||||||
@@ -85,7 +84,7 @@ jobs:
|
|||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
"FROM scratch" \
|
"FROM scratch" \
|
||||||
"LABEL maintainer=\"fithwum\"" \
|
"LABEL maintainer=\"fithwum\"" \
|
||||||
"ADD alpine-$ALPINE_VERSIONS.tar.gz /" \
|
"ADD alpine-$version.tar.gz /" \
|
||||||
"CMD [\"/bin/sh\"]" > "$DOCKERFILE_PATH"
|
"CMD [\"/bin/sh\"]" > "$DOCKERFILE_PATH"
|
||||||
|
|
||||||
echo "[INFO] Created $DOCKERFILE_PATH"
|
echo "[INFO] Created $DOCKERFILE_PATH"
|
||||||
|
|||||||
21
Dockerfile
21
Dockerfile
@@ -1,12 +1,10 @@
|
|||||||
FROM alpine:3.20 AS builder
|
FROM alpine:latest AS builder
|
||||||
LABEL maintainer="fithwum"
|
LABEL maintainer="fithwum"
|
||||||
|
|
||||||
WORKDIR /builder
|
WORKDIR /builder
|
||||||
|
|
||||||
# Install tools needed for building rootfs
|
# Install tools needed for building rootfs
|
||||||
RUN apk update && apk add --no-cache \
|
RUN apk update && apk add --no-cache bash curl wget git jq ca-certificates coreutils tar gzip
|
||||||
bash curl wget git jq ca-certificates coreutils \
|
|
||||||
tar gzip
|
|
||||||
|
|
||||||
# Download alpine-make-rootfs script
|
# Download alpine-make-rootfs script
|
||||||
RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master/alpine-make-rootfs \
|
RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master/alpine-make-rootfs \
|
||||||
@@ -14,24 +12,25 @@ RUN wget https://raw.githubusercontent.com/alpinelinux/alpine-make-rootfs/master
|
|||||||
|
|
||||||
# Build the rootfs
|
# Build the rootfs
|
||||||
RUN ./alpine-make-rootfs \
|
RUN ./alpine-make-rootfs \
|
||||||
--branch v3.20 \
|
--branch ${ALPINE_VERSION} \
|
||||||
--mirror http://dl-cdn.alpinelinux.org/alpine \
|
--mirror http://dl-cdn.alpinelinux.org/alpine \
|
||||||
--packages "bash curl ca-certificates nano" \
|
--packages "bash curl ca-certificates nano" \
|
||||||
alpine-rootfs
|
alpine-rootfs
|
||||||
|
|
||||||
# Run custom script inside rootfs without chroot (simulate setup)
|
# Run custom script inside rootfs
|
||||||
COPY base-image-script/alpine-base_pt2.sh /builder/alpine-rootfs/
|
COPY base-image-script/alpine-base_pt2.sh /builder/alpine-rootfs/
|
||||||
RUN chmod +x /builder/alpine-rootfs/alpine-base_pt2.sh && \
|
RUN chmod +x /builder/alpine-rootfs/alpine-base_pt2.sh && \
|
||||||
chroot /builder/alpine-rootfs /alpine-base_pt2.sh || true
|
chroot /builder/alpine-rootfs /alpine-base_pt2.sh || true
|
||||||
|
|
||||||
# Clean up the part2 script after execution
|
# Clean up script
|
||||||
RUN rm -f /builder/alpine-rootfs/alpine-base_pt2.sh
|
RUN rm -f /builder/alpine-rootfs/alpine-base_pt2.sh
|
||||||
|
|
||||||
# Package it
|
# Package with versioned filename
|
||||||
RUN mkdir -p /output && \
|
RUN mkdir -p /output && \
|
||||||
tar -czf /output/alpine-base.tar.gz -C alpine-rootfs .
|
tar -czf /output/alpine-${ALPINE_VERSION}.tar.gz -C alpine-rootfs .
|
||||||
|
|
||||||
# Final image to export tarball
|
# Final stage just copies the archive
|
||||||
FROM scratch AS export-stage
|
FROM scratch AS export-stage
|
||||||
COPY --from=builder /output/alpine-base.tar.gz /output/alpine-base.tar.gz
|
ARG ALPINE_VERSION
|
||||||
|
COPY --from=builder /output/alpine-${ALPINE_VERSION}.tar.gz /output/alpine-${ALPINE_VERSION}.tar.gz
|
||||||
CMD ["sleep", "infinity"]
|
CMD ["sleep", "infinity"]
|
||||||
Reference in New Issue
Block a user