Skip to content

Commit 55a7f80

Browse files
committed
GHA: Use native arm, update nodejs
1 parent 332ec80 commit 55a7f80

File tree

2 files changed

+32
-53
lines changed

2 files changed

+32
-53
lines changed

.github/workflows/matrix.yml

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and push
1+
name: docker-build
22

33
on:
44
push:
@@ -7,74 +7,63 @@ on:
77
tags:
88
- "v[0-9]+.[0-9]+.[0-9]+"
99

10-
env:
11-
REGISTRY_IMAGE: netfloex/quickadd
12-
1310
jobs:
1411
tests:
1512
runs-on: ubuntu-latest
1613
steps:
1714
- name: Setup yarn and install dependencies
1815
uses: netfloex/actions/yarn@master
1916
with:
20-
node-version: 18.18.0
17+
node-version: 22.14.0
2118

2219
- name: Check Types
2320
run: yarn typescript
2421

2522
- name: Test ESLint
2623
run: yarn lint
2724

28-
build:
29-
needs:
30-
- tests
31-
runs-on: ubuntu-latest
25+
docker:
3226
strategy:
33-
fail-fast: false
3427
matrix:
35-
platform:
36-
- linux/amd64
37-
- linux/arm64
38-
steps:
39-
- name: Prepare
40-
run: |
41-
platform=${{ matrix.platform }}
42-
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
28+
include:
29+
- os: ubuntu-latest
30+
arch: amd64
31+
- os: ubuntu-24.04-arm
32+
arch: arm64
4333

44-
- name: Checkout
45-
uses: actions/checkout@v4
34+
runs-on: ${{ matrix.os }}
35+
needs: tests
4636

37+
steps:
4738
- name: Docker meta
4839
id: meta
49-
uses: docker/metadata-action@v5
40+
uses: docker/metadata-action@v4
5041
with:
51-
images: ${{ env.REGISTRY_IMAGE }}
42+
images: |
43+
${{ vars.REGISTRY_IMAGE }}
5244
tags: |
5345
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
5446
type=semver,pattern=v{{major}}.{{minor}}
5547
type=semver,pattern=v{{major}}
5648
type=raw,value=latest
5749
58-
- name: Set up QEMU
59-
uses: docker/setup-qemu-action@v3
60-
6150
- name: Set up Docker Buildx
6251
uses: docker/setup-buildx-action@v3
6352

6453
- name: Login to Docker Hub
6554
uses: docker/login-action@v3
6655
with:
67-
username: ${{ secrets.DOCKERHUB_USERNAME }}
56+
username: ${{ vars.DOCKERHUB_USERNAME }}
6857
password: ${{ secrets.DOCKERHUB_TOKEN }}
6958

7059
- name: Build and push by digest
7160
id: build
7261
uses: docker/build-push-action@v5
7362
with:
74-
context: .
75-
platforms: ${{ matrix.platform }}
63+
platforms: ${{ matrix.arch }}
7664
labels: ${{ steps.meta.outputs.labels }}
77-
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
65+
outputs: type=image,name=${{ vars.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
66+
7867
cache-from: type=gha
7968
cache-to: type=gha,mode=max
8069

@@ -84,18 +73,20 @@ jobs:
8473
digest="${{ steps.build.outputs.digest }}"
8574
touch "/tmp/digests/${digest#sha256:}"
8675
76+
# Create platform variable with a / changed to - (e.g. linux/amd64 to linux-amd64)
77+
platform=linux/${{ matrix.arch }}
78+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
79+
8780
- name: Upload digest
8881
uses: actions/upload-artifact@v4
8982
with:
9083
name: digests-${{ env.PLATFORM_PAIR }}
9184
path: /tmp/digests/*
9285
if-no-files-found: error
9386
retention-days: 1
94-
9587
merge:
9688
runs-on: ubuntu-latest
97-
needs:
98-
- build
89+
needs: docker
9990
steps:
10091
- name: Download digests
10192
uses: actions/download-artifact@v4
@@ -104,14 +95,11 @@ jobs:
10495
pattern: digests-*
10596
merge-multiple: true
10697

107-
- name: Set up Docker Buildx
108-
uses: docker/setup-buildx-action@v3
109-
11098
- name: Docker meta
11199
id: meta
112100
uses: docker/metadata-action@v5
113101
with:
114-
images: ${{ env.REGISTRY_IMAGE }}
102+
images: ${{ vars.REGISTRY_IMAGE }}
115103
tags: |
116104
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
117105
type=semver,pattern=v{{major}}.{{minor}}
@@ -121,15 +109,11 @@ jobs:
121109
- name: Login to Docker Hub
122110
uses: docker/login-action@v3
123111
with:
124-
username: netfloex
112+
username: ${{ vars.DOCKERHUB_USERNAME }}
125113
password: ${{ secrets.DOCKERHUB_TOKEN }}
126114

127115
- name: Create manifest list and push
128116
working-directory: /tmp/digests
129117
run: |
130118
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
131-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
132-
133-
- name: Inspect image
134-
run: |
135-
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
119+
$(printf '${{ vars.REGISTRY_IMAGE }}@sha256:%s ' *)

Dockerfile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG NODE_IMAGE=node:18-alpine
1+
ARG NODE_IMAGE=node:22-alpine
22

33
FROM $NODE_IMAGE AS deps
44
WORKDIR /app
@@ -13,27 +13,22 @@ WORKDIR /app
1313

1414
COPY . .
1515
COPY --from=deps /app/node_modules ./node_modules
16-
ENV NEXT_TELEMETRY_DISABLED 1
17-
18-
16+
ENV NEXT_TELEMETRY_DISABLED=1
1917

2018
RUN yarn build
2119

22-
2320
FROM $NODE_IMAGE AS runner
2421

2522
WORKDIR /app
2623

27-
ENV NODE_ENV production
28-
ENV STORE_PATH /data/store.json
29-
ENV FORCE_COLOR 1
24+
ENV NODE_ENV=production
25+
ENV STORE_PATH=/data/store.json
26+
ENV FORCE_COLOR=1
3027

3128
COPY --from=builder /app/.next/standalone ./
3229
COPY --from=builder /app/.next/static ./.next/static
3330
COPY --from=builder /app/public ./public
3431

35-
36-
3732
EXPOSE 3000
3833

39-
CMD ["node", "server"]
34+
CMD ["node", "server"]

0 commit comments

Comments
 (0)