Skip to content

Commit 1dbc381

Browse files
committed
test
1 parent 314ef4b commit 1dbc381

File tree

2 files changed

+54
-21
lines changed

2 files changed

+54
-21
lines changed

.github/workflows/build_default.yaml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,23 @@ permissions:
2020
#------------------------------------------------------------------------------------#
2121
jobs:
2222
build-push-alpine:
23-
name: Push (Alpine) --> Docker Hub
24-
runs-on: "ubuntu-latest"
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
2540

2641
steps:
2742
- name: Checkout repository
@@ -106,9 +121,9 @@ jobs:
106121
echo "DOCKER_TAG=${DOCKER_TAG}" >> "${GITHUB_ENV}"
107122
#Copy dockerfiles
108123
mkdir -p "/tmp/DOCKERFILES" && cd "/tmp/DOCKERFILES"
109-
#cp "${GITHUB_WORKSPACE}/main/Github/Runners/alpine.dockerfile" "/tmp/DOCKERFILES/alpine.dockerfile"
110-
cp -fv "${GITHUB_WORKSPACE}/main/Github/Runners/docker-bake.hcl" "/tmp/DOCKERFILES/docker-bake.hcl"
124+
cp "${GITHUB_WORKSPACE}/main/Github/Runners/alpine.dockerfile" "/tmp/DOCKERFILES/alpine.dockerfile"
111125
#Download Rootfs
126+
if [[ "${{ matrix.platform }}" == "loong64" ]]; then
112127
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:]')"
113128
for i in {1..3}; do
114129
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
@@ -126,6 +141,7 @@ jobs:
126141
fi
127142
[[ $i -eq 3 ]] && { echo "Failed after 3 attempts"; exit 1; }
128143
done
144+
fi
129145
continue-on-error: false
130146

131147
- name: Set up QEMU
@@ -151,9 +167,34 @@ jobs:
151167
password: "${{ secrets.GITHUB_TOKEN }}"
152168
continue-on-error: true
153169

154-
- name: Bake and push all targets
155-
uses: docker/bake-action@v4
170+
#https://hub.docker.com/r/pkgforge/alpine
171+
- name: Docker Build and Push (alpine - multi-platform)
172+
uses: docker/build-push-action@v6
156173
with:
157-
files: /tmp/DOCKERFILES/docker-bake.hcl
158-
targets: default
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:edge
180+
pkgforge/alpine:edge-${{ env.DOCKER_TAG }}
181+
ghcr.io/pkgforge/devscripts/alpine:edge
182+
ghcr.io/pkgforge/devscripts/alpine:edge-${{ 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)
187+
uses: docker/build-push-action@v6
188+
with:
189+
context: /tmp/DOCKERFILES/
190+
file: "/tmp/DOCKERFILES/alpine.dockerfile"
191+
platforms: "linux/loong64"
192+
target: final-loong64
193+
tags: |
194+
pkgforge/alpine:edge
195+
pkgforge/alpine:edge-${{ env.DOCKER_TAG }}
196+
ghcr.io/pkgforge/devscripts/alpine:edge
197+
ghcr.io/pkgforge/devscripts/alpine:edge-${{ env.DOCKER_TAG }}
198+
outputs: type=registry,compression=zstd,compression-level=22
199+
continue-on-error: true
159200
#------------------------------------------------------------------------------------#

Github/Runners/alpine.dockerfile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
# syntax=docker/dockerfile:1
22
#------------------------------------------------------------------------------------#
33

4-
ARG TARGETARCH
5-
64
# Default stage for most architectures
7-
FROM alpine:edge AS base-standard
8-
RUN apk add --no-cache ca-certificates tzdata
5+
FROM alpine:edge AS final
6+
RUN apk add ca-certificates tzdata --latest --upgrade --no-cache --no-interactive
97
CMD ["/bin/sh"]
108

119
# Special stage for loong64
12-
FROM scratch AS base-loong64
10+
FROM scratch AS final-loong64
1311
ADD alpine-minirootfs-loongarch64.tar.gz /
14-
RUN apk add --no-cache ca-certificates tzdata
15-
CMD ["/bin/sh"]
16-
17-
# Final stage with conditional logic
18-
FROM scratch AS final
19-
COPY --from=base-${TARGETARCH:-standard} / /
20-
# For loong64, this will copy from base-loong64
21-
# For others, this will copy from base-standard
12+
RUN apk add ca-certificates tzdata --latest --upgrade --no-cache --no-interactive
13+
CMD ["/bin/sh"]

0 commit comments

Comments
 (0)