Skip to content

Commit bfc21c8

Browse files
committed
ci: push ARM64 Docker image to GHCR
1 parent 3e4a741 commit bfc21c8

2 files changed

Lines changed: 22 additions & 76 deletions

File tree

.github/workflows/main-docker.yml

Lines changed: 19 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ on:
55
workflows: ["Release Build"]
66
types:
77
- completed
8+
89
env:
9-
REGISTRY_IMAGE: quay.io/redlib/redlib
10+
REGISTRY_IMAGE: ghcr.io/algorithm5838/redlib
1011

1112
jobs:
1213
build:
1314
runs-on: ubuntu-latest
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
include:
18-
- { platform: linux/amd64, target: x86_64-unknown-linux-musl }
19-
- { platform: linux/arm64, target: aarch64-unknown-linux-musl }
20-
- { platform: linux/arm/v7, target: armv7-unknown-linux-musleabihf }
15+
# Only build if the Release Build succeeded
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2117
steps:
2218
- name: Checkout
2319
uses: actions/checkout@v4
20+
2421
- name: Docker meta
2522
id: meta
2623
uses: docker/metadata-action@v5
@@ -29,80 +26,29 @@ jobs:
2926
tags: |
3027
type=sha
3128
type=raw,value=latest,enable={{is_default_branch}}
32-
- name: Set up QEMU
33-
uses: docker/setup-qemu-action@v3
29+
3430
- name: Set up Docker Buildx
3531
uses: docker/setup-buildx-action@v3
36-
- name: Login to Quay.io Container Registry
32+
33+
- name: Login to GitHub Container Registry
3734
uses: docker/login-action@v3
3835
with:
39-
registry: quay.io
40-
username: ${{ secrets.QUAY_USERNAME }}
41-
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
42-
- name: Build and push
43-
id: build
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Build and push (ARM64)
4441
uses: docker/build-push-action@v5
4542
with:
4643
context: .
47-
platforms: ${{ matrix.platform }}
44+
platforms: linux/arm64
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
4847
labels: ${{ steps.meta.outputs.labels }}
49-
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
5048
file: Dockerfile
51-
build-args: TARGET=${{ matrix.target }}
52-
- name: Export digest
53-
run: |
54-
mkdir -p /tmp/digests
55-
digest="${{ steps.build.outputs.digest }}"
56-
touch "/tmp/digests/${digest#sha256:}"
57-
- name: Upload digest
58-
uses: actions/upload-artifact@v4
59-
with:
60-
name: digests-${{ matrix.target }}
61-
path: /tmp/digests/*
62-
if-no-files-found: error
63-
retention-days: 1
64-
merge:
65-
runs-on: ubuntu-latest
66-
needs:
67-
- build
68-
steps:
69-
- name: Download digests
70-
uses: actions/download-artifact@v4.1.7
71-
with:
72-
path: /tmp/digests
73-
pattern: digests-*
74-
merge-multiple: true
75-
76-
- name: Set up Docker Buildx
77-
uses: docker/setup-buildx-action@v3
78-
- name: Docker meta
79-
id: meta
80-
uses: docker/metadata-action@v5
81-
with:
82-
images: ${{ env.REGISTRY_IMAGE }}
83-
tags: |
84-
type=sha
85-
type=raw,value=latest,enable={{is_default_branch}}
86-
- name: Login to Quay.io Container Registry
87-
uses: docker/login-action@v3
88-
with:
89-
registry: quay.io
90-
username: ${{ secrets.QUAY_USERNAME }}
91-
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
92-
- name: Create manifest list and push
93-
working-directory: /tmp/digests
94-
run: |
95-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
96-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
97-
98-
# - name: Push README to Quay.io
99-
# uses: christian-korneck/update-container-description-action@v1
100-
# env:
101-
# DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }}
102-
# with:
103-
# destination_container_repo: quay.io/redlib/redlib
104-
# provider: quay
105-
# readme_file: 'README.md'
49+
build-args: |
50+
TARGET=aarch64-unknown-linux-musl
51+
GITHUB_REPOSITORY=${{ github.repository }}
10652
10753
- name: Inspect image
10854
run: |

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
FROM alpine:3.19
22

3-
ARG TARGET
3+
ARG TARGET=aarch64-unknown-linux-musl
4+
ARG GITHUB_REPOSITORY=Algorithm5838/redlib
45

56
RUN apk add --no-cache curl
67

7-
RUN curl -L "https://github.com/redlib-org/redlib/releases/latest/download/redlib-${TARGET}.tar.gz" | \
8+
RUN curl -L "https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/redlib-${TARGET}.tar.gz" | \
89
tar xz -C /usr/local/bin/
910

1011
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
@@ -17,4 +18,3 @@ EXPOSE 8080
1718
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1
1819

1920
CMD ["redlib"]
20-

0 commit comments

Comments
 (0)