1+ name : 🐬 Builds Base Images DockerHub 🐬
2+ # REF: https://docs.docker.com/build/ci/github-actions/multi-platform/
3+ # SECRETS: DOCKERHUB_USERNAME || DOCKERHUB_TOKEN
4+ # URL: https://hub.docker.com/u/pkgforge
5+
6+ # ------------------------------------------------------------------------------------#
7+ on :
8+ # push:
9+ workflow_dispatch :
10+ schedule :
11+ - cron : " 30 08 * * 3" # 08:30 PM UTC Thu (02:15 AM NPT Thu Midnight)
12+ # - cron: "*/30 * * * *" # Every 30 Mins
13+ defaults :
14+ run :
15+ shell : bash
16+ working-directory : /tmp
17+ permissions :
18+ contents : read
19+ packages : write
20+ # ------------------------------------------------------------------------------------#
21+ jobs :
22+ build-push-alpine :
23+ name : Push (Alpine ${{ matrix.arch }}) --> Docker Hub
24+ runs-on : ${{ matrix.runner }}
25+ strategy :
26+ matrix :
27+ include :
28+ - arch : aarch64
29+ platform : arm64
30+ runner : ubuntu-24.04-arm
31+ - arch : loongarch64
32+ platform : loong64
33+ runner : ubuntu-latest
34+ - arch : riscv64
35+ platform : riscv64
36+ runner : ubuntu-latest
37+ - arch : x86_64
38+ platform : amd64
39+ runner : ubuntu-latest
40+
41+ steps :
42+ - name : Checkout repository
43+ uses : actions/checkout@v4
44+ with :
45+ path : main
46+ filter : " blob:none"
47+
48+ - name : Debloat Runner
49+ run : |
50+ #Presets
51+ set +x ; set +e
52+ #--------------#
53+ bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/debloat_ubuntu.sh")
54+ continue-on-error : true
55+
56+ - name : Install Addons
57+ run : |
58+ ##Presets
59+ set +x ; set +e
60+ #-------------#
61+ ##Debug?
62+ if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then
63+ set -x
64+ fi
65+ #-------------#
66+ #export PARALLEL=1
67+ #bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh")
68+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/bin/7z" &
69+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/local/bin/7z" &
70+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/ansi2txt" -o "/usr/local/bin/ansi2txt" &
71+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2" &
72+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2c" &
73+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/askalono" -o "/usr/local/bin/askalono" &
74+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/bsdtar" -o "/usr/local/bin/bsdtar" &
75+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/b3sum" -o "/usr/local/bin/b3sum" &
76+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/dasel" -o "/usr/local/bin/dasel" &
77+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/eget" -o "/usr/local/bin/eget" &
78+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/huggingface-cli" -o "/usr/local/bin/huggingface-cli" &
79+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/jq" -o "/usr/local/bin/jq" &
80+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/oras" -o "/usr/local/bin/oras" &
81+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/ouch" -o "/usr/local/bin/ouch" &
82+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/rsync" -o "/usr/local/bin/rsync" &
83+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/trufflehog" -o "/usr/local/bin/trufflehog" &
84+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/xq" -o "/usr/local/bin/xq" &
85+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/xz" -o "/usr/local/bin/xz" &
86+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/yq" -o "/usr/local/bin/yq" &
87+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/zstd" -o "/usr/bin/zstd" &
88+ sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/zstd" -o "/usr/local/bin/zstd" &
89+ wait ; echo
90+ sudo chmod -v 'a+x' \
91+ "/usr/bin/7z" \
92+ "/usr/local/bin/7z" \
93+ "/usr/local/bin/ansi2txt" \
94+ "/usr/local/bin/aria2" \
95+ "/usr/local/bin/aria2c" \
96+ "/usr/local/bin/askalono" \
97+ "/usr/local/bin/bsdtar" \
98+ "/usr/local/bin/b3sum" \
99+ "/usr/local/bin/dasel" \
100+ "/usr/local/bin/eget" \
101+ "/usr/local/bin/huggingface-cli" \
102+ "/usr/local/bin/jq" \
103+ "/usr/local/bin/oras" \
104+ "/usr/local/bin/ouch" \
105+ "/usr/local/bin/rsync" \
106+ "/usr/local/bin/trufflehog" \
107+ "/usr/local/bin/xq" \
108+ "/usr/local/bin/xz" \
109+ "/usr/local/bin/yq" \
110+ "/usr/bin/zstd" \
111+ "/usr/local/bin/zstd"
112+ continue-on-error : true
113+
114+ - name : Setup Env
115+ run : |
116+ #Presets
117+ set +x ; set +e
118+ #--------------#
119+ #Docker Tags
120+ DOCKER_TAG="v$(date +'%Y.%m.%d')" && export DOCKER_TAG="${DOCKER_TAG}"
121+ echo "DOCKER_TAG=${DOCKER_TAG}" >> "${GITHUB_ENV}"
122+ #Copy dockerfiles
123+ mkdir -p "/tmp/DOCKERFILES" && cd "/tmp/DOCKERFILES"
124+ cp "${GITHUB_WORKSPACE}/main/Github/Runners/alpine.dockerfile" "/tmp/DOCKERFILES/alpine.dockerfile"
125+ #Download Rootfs
126+ if [[ "${{ matrix.platform }}" == "loong64" ]]; then
127+ ROOTFS_FILE="$(curl -qfsSL "https://dl-cdn.alpinelinux.org/alpine/edge/releases/loongarch64/latest-releases.yaml" | grep -oE 'alpine-[^[:space:]"'\'']+\.tar\.gz' | sed 's/[[:space:]]*$//' | sort -u | head -1 | tr -d '"'\''[:space:]')"
128+ for i in {1..3}; do
129+ if curl -w "(DL) <== %{url}\n" -qfsSL "https://dl-cdn.alpinelinux.org/alpine/edge/releases/loongarch64/${ROOTFS_FILE}" -o "/tmp/alpine-minirootfs-loongarch64.tar.gz"; then
130+ if tar -tzf "/tmp/alpine-minirootfs-loongarch64.tar.gz" &>/dev/null; then
131+ break
132+ else
133+ echo "Invalid tar archive, retrying... ($i/3)"
134+ rm -fv "/tmp/alpine-minirootfs-loongarch64.tar.gz"
135+ fi
136+ else
137+ echo "Download failed, retrying... ($i/3)"
138+ fi
139+ [[ $i -eq 3 ]] && { echo "Failed after 3 attempts"; exit 1; }
140+ done
141+ fi
142+ continue-on-error : false
143+
144+ - name : Set up QEMU
145+ uses : docker/setup-qemu-action@v3
146+ continue-on-error : true
147+
148+ - name : Set up Docker Buildx
149+ uses : docker/setup-buildx-action@v3
150+ continue-on-error : true
151+
152+ - name : Login to Docker Hub
153+ uses : docker/login-action@v3
154+ with :
155+ username : " ${{ secrets.DOCKERHUB_USERNAME }}"
156+ password : " ${{ secrets.DOCKERHUB_TOKEN }}"
157+ continue-on-error : true
158+
159+ - name : Login to GHCR
160+ uses : docker/login-action@v3
161+ with :
162+ registry : ghcr.io
163+ username : " ${{ github.actor }}"
164+ password : " ${{ secrets.GITHUB_TOKEN }}"
165+ continue-on-error : true
166+
167+ # https://hub.docker.com/r/pkgforge/alpine
168+ - name : Docker Build and Push (alpine)
169+ uses : docker/build-push-action@v6
170+ with :
171+ context : /tmp/DOCKERFILES/
172+ file : " /tmp/DOCKERFILES/alpine.dockerfile"
173+ platforms : " linux/${{ matrix.platform }}"
174+ build-args : |
175+ TARGETARCH="${{ matrix.platform }}"
176+ tags : |
177+ #pkgforge/alpine:${{ matrix.arch }}
178+ #pkgforge/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
179+ pkgforge/alpine:edge
180+ pkgforge/alpine:edge-${{ env.DOCKER_TAG }}
181+ #ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}
182+ #ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
183+ ghcr.io/pkgforge/devscripts/alpine:edge
184+ ghcr.io/pkgforge/devscripts/alpine:edge-${{ env.DOCKER_TAG }}
185+ outputs : type=registry,compression=zstd,compression-level=22
186+ continue-on-error : true
187+ # ------------------------------------------------------------------------------------#
0 commit comments