Skip to content

Commit fd2f5ec

Browse files
committed
test
1 parent 660315b commit fd2f5ec

File tree

3 files changed

+153
-37
lines changed

3 files changed

+153
-37
lines changed

.github/workflows/build_default.yaml renamed to .github/workflows/build_default_alpine.yaml

Lines changed: 138 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ defaults:
1717
permissions:
1818
contents: read
1919
packages: write
20-
#------------------------------------------------------------------------------------#
21-
jobs:
20+
jobs:
21+
#------------------------------------------------------------------------------------#
2222
build-push-alpine:
2323
name: Push (Alpine ${{ matrix.arch }}) --> Docker Hub
2424
runs-on: ${{ matrix.runner }}
@@ -28,9 +28,9 @@ jobs:
2828
- arch: aarch64
2929
platform: arm64
3030
runner: ubuntu-24.04-arm
31-
- arch: loongarch64
32-
platform: loong64
33-
runner: ubuntu-latest
31+
#- arch: loongarch64
32+
# platform: loong64
33+
# runner: ubuntu-latest
3434
- arch: riscv64
3535
platform: riscv64
3636
runner: ubuntu-latest
@@ -122,8 +122,135 @@ jobs:
122122
#Copy dockerfiles
123123
mkdir -p "/tmp/DOCKERFILES" && cd "/tmp/DOCKERFILES"
124124
cp "${GITHUB_WORKSPACE}/main/Github/Runners/alpine.dockerfile" "/tmp/DOCKERFILES/alpine.dockerfile"
125+
continue-on-error: false
126+
127+
- name: Set up QEMU
128+
uses: docker/setup-qemu-action@v3
129+
continue-on-error: true
130+
131+
- name: Set up Docker Buildx
132+
uses: docker/setup-buildx-action@v3
133+
continue-on-error: true
134+
135+
- name: Login to Docker Hub
136+
uses: docker/login-action@v3
137+
with:
138+
username: "${{ secrets.DOCKERHUB_USERNAME }}"
139+
password: "${{ secrets.DOCKERHUB_TOKEN }}"
140+
continue-on-error: true
141+
142+
- name: Login to GHCR
143+
uses: docker/login-action@v3
144+
with:
145+
registry: ghcr.io
146+
username: "${{ github.actor }}"
147+
password: "${{ secrets.GITHUB_TOKEN }}"
148+
continue-on-error: true
149+
150+
#https://hub.docker.com/r/pkgforge/alpine
151+
- name: Docker Build and Push (Alpine)
152+
uses: docker/build-push-action@v6
153+
with:
154+
context: /tmp/DOCKERFILES/
155+
file: "/tmp/DOCKERFILES/alpine.dockerfile"
156+
platforms: "linux/${{ matrix.platform }}"
157+
tags: |
158+
pkgforge/alpine:${{ matrix.arch }}
159+
pkgforge/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
160+
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}
161+
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
162+
push: true
163+
continue-on-error: true
164+
#------------------------------------------------------------------------------------#
165+
build-push-alpine-loongarch64:
166+
name: Push (Alpine ${{ matrix.arch }}) --> Docker Hub
167+
runs-on: "ubuntu-latest"
168+
169+
steps:
170+
- name: Checkout repository
171+
uses: actions/checkout@v4
172+
with:
173+
path: main
174+
filter: "blob:none"
175+
176+
#- name: Debloat Runner
177+
# run: |
178+
# #Presets
179+
# set +x ; set +e
180+
# #--------------#
181+
# bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/debloat_ubuntu.sh")
182+
# continue-on-error: true
183+
184+
- name: Install Addons
185+
run: |
186+
##Presets
187+
set +x ; set +e
188+
#-------------#
189+
##Debug?
190+
if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then
191+
set -x
192+
fi
193+
#-------------#
194+
#export PARALLEL=1
195+
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh")
196+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/bin/7z" &
197+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/local/bin/7z" &
198+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/ansi2txt" -o "/usr/local/bin/ansi2txt" &
199+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2" &
200+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2c" &
201+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/askalono" -o "/usr/local/bin/askalono" &
202+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/bsdtar" -o "/usr/local/bin/bsdtar" &
203+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/b3sum" -o "/usr/local/bin/b3sum" &
204+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/dasel" -o "/usr/local/bin/dasel" &
205+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/eget" -o "/usr/local/bin/eget" &
206+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/huggingface-cli" -o "/usr/local/bin/huggingface-cli" &
207+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/jq" -o "/usr/local/bin/jq" &
208+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/oras" -o "/usr/local/bin/oras" &
209+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/ouch" -o "/usr/local/bin/ouch" &
210+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/rsync" -o "/usr/local/bin/rsync" &
211+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/trufflehog" -o "/usr/local/bin/trufflehog" &
212+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/xq" -o "/usr/local/bin/xq" &
213+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/xz" -o "/usr/local/bin/xz" &
214+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/yq" -o "/usr/local/bin/yq" &
215+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/zstd" -o "/usr/bin/zstd" &
216+
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/zstd" -o "/usr/local/bin/zstd" &
217+
wait ; echo
218+
sudo chmod -v 'a+x' \
219+
"/usr/bin/7z" \
220+
"/usr/local/bin/7z" \
221+
"/usr/local/bin/ansi2txt" \
222+
"/usr/local/bin/aria2" \
223+
"/usr/local/bin/aria2c" \
224+
"/usr/local/bin/askalono" \
225+
"/usr/local/bin/bsdtar" \
226+
"/usr/local/bin/b3sum" \
227+
"/usr/local/bin/dasel" \
228+
"/usr/local/bin/eget" \
229+
"/usr/local/bin/huggingface-cli" \
230+
"/usr/local/bin/jq" \
231+
"/usr/local/bin/oras" \
232+
"/usr/local/bin/ouch" \
233+
"/usr/local/bin/rsync" \
234+
"/usr/local/bin/trufflehog" \
235+
"/usr/local/bin/xq" \
236+
"/usr/local/bin/xz" \
237+
"/usr/local/bin/yq" \
238+
"/usr/bin/zstd" \
239+
"/usr/local/bin/zstd"
240+
continue-on-error: true
241+
242+
- name: Setup Env
243+
run: |
244+
#Presets
245+
set +x ; set +e
246+
#--------------#
247+
#Docker Tags
248+
DOCKER_TAG="v$(date +'%Y.%m.%d')" && export DOCKER_TAG="${DOCKER_TAG}"
249+
echo "DOCKER_TAG=${DOCKER_TAG}" >> "${GITHUB_ENV}"
250+
#Copy dockerfiles
251+
mkdir -p "/tmp/DOCKERFILES" && cd "/tmp/DOCKERFILES"
252+
cp "${GITHUB_WORKSPACE}/main/Github/Runners/alpine_loongarch64.dockerfile" "/tmp/DOCKERFILES/alpine.dockerfile"
125253
#Download Rootfs
126-
if [[ "${{ matrix.platform }}" == "loong64" ]]; then
127254
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:]')"
128255
for i in {1..3}; do
129256
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
@@ -141,7 +268,6 @@ jobs:
141268
fi
142269
[[ $i -eq 3 ]] && { echo "Failed after 3 attempts"; exit 1; }
143270
done
144-
fi
145271
continue-on-error: false
146272

147273
- name: Set up QEMU
@@ -168,33 +294,17 @@ jobs:
168294
continue-on-error: true
169295

170296
#https://hub.docker.com/r/pkgforge/alpine
171-
- name: Docker Build and Push (alpine - multi-platform)
172-
uses: docker/build-push-action@v6
173-
with:
174-
context: /tmp/DOCKERFILES/
175-
file: "/tmp/DOCKERFILES/alpine.dockerfile"
176-
platforms: "linux/amd64,linux/arm64,linux/riscv64"
177-
target: final
178-
tags: |
179-
pkgforge/alpine:${{ matrix.arch }}
180-
pkgforge/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
181-
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}
182-
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
183-
outputs: type=registry,compression=zstd,compression-level=22
184-
continue-on-error: true
185-
186-
- name: Docker Build and Push (alpine - loong64)
297+
- name: Docker Build and Push (alpine - loongarch64)
187298
uses: docker/build-push-action@v6
188299
with:
189300
context: /tmp/DOCKERFILES/
190301
file: "/tmp/DOCKERFILES/alpine.dockerfile"
191302
platforms: "linux/loong64"
192-
target: final-loong64
193303
tags: |
194-
pkgforge/alpine:${{ matrix.arch }}
195-
pkgforge/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
196-
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}
197-
ghcr.io/pkgforge/devscripts/alpine:${{ matrix.arch }}-${{ env.DOCKER_TAG }}
304+
pkgforge/alpine:loongarch64
305+
pkgforge/alpine:loongarch64-${{ env.DOCKER_TAG }}
306+
ghcr.io/pkgforge/devscripts/alpine:loongarch64
307+
ghcr.io/pkgforge/devscripts/alpine:loongarch64-${{ env.DOCKER_TAG }}
198308
outputs: type=registry,compression=zstd,compression-level=22
199309
continue-on-error: true
200310
#------------------------------------------------------------------------------------#

Github/Runners/alpine.dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# syntax=docker/dockerfile:1
22
#------------------------------------------------------------------------------------#
3-
4-
# Default stage for most architectures
5-
FROM alpine:edge AS final
3+
FROM alpine:edge
4+
ENV GIT_ASKPASS="/bin/echo"
5+
ENV GIT_TERMINAL_PROMPT="0"
66
RUN apk add ca-certificates tzdata --latest --upgrade --no-cache --no-interactive
77
CMD ["/bin/sh"]
8-
9-
# Special stage for loong64
10-
FROM scratch AS final-loong64
11-
ADD alpine-minirootfs-loongarch64.tar.gz /
12-
RUN apk add ca-certificates tzdata --latest --upgrade --no-cache --no-interactive
13-
CMD ["/bin/sh"]
8+
#------------------------------------------------------------------------------------#
9+
#END
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# syntax=docker/dockerfile:1
2+
#------------------------------------------------------------------------------------#
3+
FROM scratch
4+
ADD alpine-minirootfs-loongarch64.tar.gz /
5+
ENV GIT_ASKPASS="/bin/echo"
6+
ENV GIT_TERMINAL_PROMPT="0"
7+
RUN apk add ca-certificates tzdata --latest --upgrade --no-cache --no-interactive
8+
CMD ["/bin/sh"]
9+
#------------------------------------------------------------------------------------#
10+
#END

0 commit comments

Comments
 (0)