test
Some checks failed
Build Alpine RootFS and Docker Image (latest) / build-rootfs (push) Failing after 13s
Build Alpine RootFS and Docker Image (latest) / push-tarball (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / push-docker (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / update-changelog (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / update-build-info (push) Has been skipped
Some checks failed
Build Alpine RootFS and Docker Image (latest) / build-rootfs (push) Failing after 13s
Build Alpine RootFS and Docker Image (latest) / push-tarball (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / push-docker (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / update-changelog (push) Has been skipped
Build Alpine RootFS and Docker Image (latest) / update-build-info (push) Has been skipped
This commit is contained in:
@@ -23,6 +23,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build custom Alpine builder image
|
- name: Build custom Alpine builder image
|
||||||
run: |
|
run: |
|
||||||
docker build -t alpine-builder:latest .
|
docker build -t alpine-builder:latest .
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ set -e
|
|||||||
|
|
||||||
# Alpine version
|
# Alpine version
|
||||||
ALPINE_VERSION="v3.20"
|
ALPINE_VERSION="v3.20"
|
||||||
ROOTFS_DIR="alpine-rootfs"
|
BUILD_DIR="/mnt/alpine-rootfs" # <--- use safe path NOT in bind mount
|
||||||
OUTPUT_TAR="alpine-base.tar.gz"
|
OUTPUT_TAR="alpine-base.tar.gz"
|
||||||
PACKAGES="bash curl ca-certificates nano"
|
PACKAGES="bash curl ca-certificates nano"
|
||||||
|
|
||||||
@@ -20,19 +20,19 @@ sudo ./alpine-make-rootfs \
|
|||||||
--branch "$ALPINE_VERSION" \
|
--branch "$ALPINE_VERSION" \
|
||||||
--mirror http://dl-cdn.alpinelinux.org/alpine \
|
--mirror http://dl-cdn.alpinelinux.org/alpine \
|
||||||
--packages "$PACKAGES" \
|
--packages "$PACKAGES" \
|
||||||
"$ROOTFS_DIR"
|
"$BUILD_DIR"
|
||||||
|
|
||||||
echo "[INFO] Binding system directories for chroot..."
|
echo "[INFO] Binding system directories for chroot..."
|
||||||
sudo mount --bind /dev "$ROOTFS_DIR/dev"
|
sudo mount --bind /dev "$BUILD_DIR/dev"
|
||||||
sudo mount --bind /proc "$ROOTFS_DIR/proc"
|
sudo mount --bind /proc "$BUILD_DIR/proc"
|
||||||
sudo mount --bind /sys "$ROOTFS_DIR/sys"
|
sudo mount --bind /sys "$BUILD_DIR/sys"
|
||||||
|
|
||||||
echo "[INFO] Copying part 2 script into chroot..."
|
echo "[INFO] Copying part 2 script into chroot..."
|
||||||
sudo cp base-image-script/alpine-base_pt2.sh "$ROOTFS_DIR/alpine-base_pt2.sh"
|
sudo cp base-image-script/alpine-base_pt2.sh "$BUILD_DIR/alpine-base_pt2.sh"
|
||||||
sudo chmod +x "$ROOTFS_DIR/alpine-base_pt2.sh"
|
sudo chmod +x "$BUILD_DIR/alpine-base_pt2.sh"
|
||||||
|
|
||||||
echo "[INFO] Entering chroot. Run 'exit' when done."
|
echo "[INFO] Entering chroot. Run 'exit' when done."
|
||||||
sudo chroot "$ROOTFS_DIR" /alpine-base_pt2.sh
|
sudo chroot "$BUILD_DIR" /alpine-base_pt2.sh
|
||||||
|
|
||||||
echo "[INFO] Continuing with packaging after chroot..."
|
echo "[INFO] Continuing with packaging after chroot..."
|
||||||
bash base-image-script/alpine-base_pt3.sh "$ROOTFS_DIR" "$OUTPUT_TAR"
|
bash base-image-script/alpine-base_pt3.sh "$BUILD_DIR" "$OUTPUT_TAR"
|
||||||
|
|||||||
@@ -3,35 +3,21 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Auto-detect rootfs dir if not passed as arg
|
ROOTFS_DIR="${1:-/mnt/alpine-rootfs}"
|
||||||
if [ -n "$1" ]; then
|
TARBALL="/workspace/output/alpine-base.tar.gz" # <-- store output in workspace for CI
|
||||||
ROOTFS_DIR="$1"
|
|
||||||
else
|
|
||||||
ROOTFS_DIR=$(find . -maxdepth 1 -type d -name "alpine-rootfs" | sed 's|^\./||' | head -n 1)
|
|
||||||
if [ -z "$ROOTFS_DIR" ]; then
|
|
||||||
echo "[ERROR] No alpine-rootfs directory found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Define output tarball location (adjust as needed)
|
|
||||||
TARBALL="/output/${ROOTFS_DIR}.tar.gz"
|
|
||||||
|
|
||||||
echo "[INFO] Unmounting system directories (ignore errors)..."
|
echo "[INFO] Unmounting system directories (ignore errors)..."
|
||||||
for dir in dev proc sys; do
|
for dir in dev proc sys; do
|
||||||
sudo umount -lf "$ROOTFS_DIR/$dir" 2>/dev/null || true
|
sudo umount -lf "$ROOTFS_DIR/$dir" 2>/dev/null || true
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "[INFO] Removing chroot script if exists..."
|
echo "[INFO] Cleaning up chroot script..."
|
||||||
sudo rm -f "$ROOTFS_DIR/alpine-base_pt2.sh" 2>/dev/null || true
|
sudo rm -f "$ROOTFS_DIR/alpine-base_pt2.sh"
|
||||||
|
|
||||||
echo "[INFO] Rootfs size:"
|
echo "[INFO] Rootfs size:"
|
||||||
du -sh "$ROOTFS_DIR"
|
du -sh "$ROOTFS_DIR"
|
||||||
|
|
||||||
echo "[INFO] Creating compressed base image tarball..."
|
echo "[INFO] Creating tarball: $TARBALL"
|
||||||
sudo tar -czf "$TARBALL" -C "$ROOTFS_DIR" .
|
sudo tar -czf "$TARBALL" -C "$ROOTFS_DIR" .
|
||||||
|
|
||||||
echo "[INFO] Tarball size:"
|
echo "[INFO] Tarball ready for CI: $TARBALL"
|
||||||
du -sh "$TARBALL"
|
|
||||||
|
|
||||||
echo "[INFO] Tarball ready for CI to upload: $TARBALL"
|
|
||||||
Reference in New Issue
Block a user