Skip to content

Commit 34ebabc

Browse files
committed
fix
1 parent 4ffec86 commit 34ebabc

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

.github/workflows/build_default.yaml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ permissions:
2121
jobs:
2222
build-push-alpine:
2323
name: Push (Alpine ${{ matrix.arch }}) --> Docker Hub
24-
runs-on: ${{ matrix.runner }}
24+
#runs-on: ${{ matrix.runner }}
25+
runs-on: "ubuntu-latest"
2526
strategy:
2627
matrix:
2728
include:
@@ -128,7 +129,8 @@ jobs:
128129
for i in {1..3}; do
129130
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
130131
if tar -tzf "/tmp/alpine-minirootfs-loongarch64.tar.gz" &>/dev/null; then
131-
echo "/tmp/alpine-minirootfs-loongarch64.tar.gz" | xargs -I "{}" bash -c \
132+
mv -fv "/tmp/alpine-minirootfs-loongarch64.tar.gz" "/tmp/DOCKERFILES/alpine-minirootfs-loongarch64.tar.gz"
133+
echo "/tmp/DOCKERFILES/alpine-minirootfs-loongarch64.tar.gz" | xargs -I "{}" bash -c \
132134
'printf "\nFile: $(basename {})\n Type: $(file -b {})\n B3sum: $(b3sum {} | cut -d" " -f1)\n SHA256sum: $(sha256sum {} | cut -d" " -f1)\n Size: $(du -bh {} | cut -f1)\n"'
133135
break
134136
else
@@ -183,15 +185,30 @@ jobs:
183185
# outputs: type=registry,compression=zstd,compression-level=22
184186
# continue-on-error: true
185187

186-
- name: Docker Build and Push (alpine)
188+
- name: Docker Build and Push (alpine - multi-platform)
189+
if: matrix.platform != 'loong64'
187190
uses: docker/build-push-action@v6
188191
with:
189192
context: /tmp/DOCKERFILES/
190193
file: "/tmp/DOCKERFILES/alpine.dockerfile"
191-
platforms: "linux/${{ matrix.platform }}"
192-
target: ${{ matrix.platform == 'loong64' && 'final-loong64' || 'final' }}
193-
build-args: |
194-
TARGETARCH=${{ matrix.platform }}
194+
platforms: "linux/amd64,linux/arm64,linux/riscv64"
195+
target: final
196+
tags: |
197+
pkgforge/alpine:edge
198+
pkgforge/alpine:edge-${{ env.DOCKER_TAG }}
199+
ghcr.io/pkgforge/devscripts/alpine:edge
200+
ghcr.io/pkgforge/devscripts/alpine:edge-${{ env.DOCKER_TAG }}
201+
outputs: type=registry,compression=zstd,compression-level=22
202+
continue-on-error: true
203+
204+
- name: Docker Build and Push (alpine - loong64)
205+
if: matrix.platform == 'loong64'
206+
uses: docker/build-push-action@v6
207+
with:
208+
context: /tmp/DOCKERFILES/
209+
file: "/tmp/DOCKERFILES/alpine.dockerfile"
210+
platforms: "linux/loong64"
211+
target: final-loong64
195212
tags: |
196213
pkgforge/alpine:edge
197214
pkgforge/alpine:edge-${{ env.DOCKER_TAG }}

Github/Runners/alpine.dockerfile

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
# syntax=docker/dockerfile:1
22
#------------------------------------------------------------------------------------#
3-
ARG TARGETARCH=amd64
43

5-
# Default base stage for most architectures
6-
FROM alpine:edge AS base-stage
7-
ARG TARGETARCH
8-
RUN if [ "$TARGETARCH" != "loong64" ]; then \
9-
apk add --no-cache ca-certificates tzdata; \
10-
fi
11-
12-
# Special base for loong64
13-
FROM scratch AS loong64-base
14-
ADD /tmp/alpine-minirootfs-loongarch64.tar.gz /
4+
# Default stage for most architectures
5+
FROM alpine:edge AS final
156
RUN apk add --no-cache ca-certificates tzdata
16-
17-
# Final conditional stage
18-
FROM base-stage AS final
19-
ARG TARGETARCH
20-
RUN if [ "$TARGETARCH" = "loong64" ]; then \
21-
echo "Error: Use loong64-base target for loong64 architecture" && exit 1; \
22-
fi
237
CMD ["/bin/sh"]
248

25-
# Dedicated final stage for loong64
26-
FROM loong64-base AS final-loong64
9+
# Special stage for loong64
10+
FROM scratch AS final-loong64
11+
ADD /tmp/alpine-minirootfs-loongarch64.tar.gz /
12+
RUN apk add --no-cache ca-certificates tzdata
2713
CMD ["/bin/sh"]

0 commit comments

Comments
 (0)