Skip to content

Commit 50bf4fe

Browse files
authored
Build Docker image for arm64 only (#125)
* Build Docker image for arm64 only Drop the linux/amd64 build and the manifest-merge job; build and push a single arm64 image tagged with the commit SHA directly. Deployments run on arm64 nodes, so the amd64 image and the multi-arch manifest are no longer needed. * Bump Erlang/OTP to 27.3.4.12 OTP versions before 27.2.2 reject valid TLS server certificates whose issuing CA carries keyCertSign together with serverAuth extended key usage, failing the handshake with key_usage_mismatch (erlang/otp#9208, fixed in public_key-1.17.1). Move to the latest 27.x patch so outbound HTTPS isn't affected. The release bundles ERTS, so the build-stage base image is what runs in prod; the debian snapshot is bumped to match the available base-image tag.
1 parent b09216b commit 50bf4fe

2 files changed

Lines changed: 13 additions & 80 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install OTP and Elixir
1919
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
2020
with:
21-
otp-version: 27.2
21+
otp-version: 27.3.4.12
2222
elixir-version: 1.18.1
2323

2424
- name: Install dependencies
@@ -37,21 +37,13 @@ jobs:
3737
mix test.all
3838
3939
docker:
40-
name: Docker (${{ matrix.platform }})
41-
runs-on: ${{ matrix.runner }}
40+
name: Docker
41+
runs-on: ubuntu-24.04-arm
4242

4343
permissions:
4444
contents: "read"
4545
id-token: "write"
4646

47-
strategy:
48-
matrix:
49-
include:
50-
- platform: linux/amd64
51-
runner: ubuntu-24.04
52-
- platform: linux/arm64
53-
runner: ubuntu-24.04-arm
54-
5547
env:
5648
IMAGE_NAME: "hexdocs"
5749
PROJECT_ID: "hexpm-prod"
@@ -63,6 +55,9 @@ jobs:
6355
with:
6456
persist-credentials: false
6557

58+
- name: Set short git commit SHA
59+
run: echo "COMMIT_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
60+
6661
- name: Set up Docker Buildx
6762
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
6863

@@ -85,74 +80,12 @@ jobs:
8580
username: "oauth2accesstoken"
8681
password: "${{ steps.auth.outputs.access_token }}"
8782

88-
- name: Build and push by digest
83+
- name: Build and push
8984
id: build
9085
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
9186
with:
92-
platforms: ${{ matrix.platform }}
93-
outputs: type=image,name=gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
94-
cache-from: type=gha,scope=${{ matrix.runner }}
95-
cache-to: type=gha,scope=${{ matrix.runner }},mode=max
96-
97-
- name: Export digest
98-
if: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
99-
run: |
100-
mkdir -p /tmp/digests
101-
digest="${DIGEST}"
102-
touch "/tmp/digests/${digest#sha256:}"
103-
env:
104-
DIGEST: ${{ steps.build.outputs.digest }}
105-
106-
- name: Upload digest
107-
if: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
108-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
109-
with:
110-
name: digests-${{ matrix.runner }}
111-
path: /tmp/digests/*
112-
if-no-files-found: error
113-
retention-days: 1
114-
115-
docker-merge:
116-
name: Docker Merge
117-
runs-on: ubuntu-24.04
118-
if: ${{ github.event_name != 'pull_request' && github.repository == 'hexpm/hexdocs' }}
119-
needs: docker
120-
permissions:
121-
contents: "read"
122-
id-token: "write"
123-
env:
124-
IMAGE_NAME: "hexdocs"
125-
PROJECT_ID: "hexpm-prod"
126-
SERVICE_ACCOUNT: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }}
127-
WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCLOUD_WORKFLOW_IDENTITY_POOL_PROVIDER }}
128-
steps:
129-
- name: Set short git commit SHA
130-
run: echo "COMMIT_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
131-
- name: Download digests
132-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
133-
with:
134-
path: /tmp/digests
135-
pattern: digests-*
136-
merge-multiple: true
137-
- name: Set up Docker Buildx
138-
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
139-
- name: Google auth
140-
id: auth
141-
uses: "google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093" # v3.0.0
142-
with:
143-
token_format: "access_token"
144-
project_id: ${{ env.PROJECT_ID }}
145-
service_account: ${{ env.SERVICE_ACCOUNT }}
146-
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
147-
- name: Docker Auth
148-
uses: "docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee" # v4.2.0
149-
with:
150-
registry: gcr.io
151-
username: "oauth2accesstoken"
152-
password: "${{ steps.auth.outputs.access_token }}"
153-
- name: Create manifest list and push
154-
working-directory: /tmp/digests
155-
run: |
156-
docker buildx imagetools create \
157-
-t gcr.io/${PROJECT_ID}/${IMAGE_NAME}:${COMMIT_SHORT_SHA} \
158-
$(printf "gcr.io/${PROJECT_ID}/${IMAGE_NAME}@sha256:%s " *)
87+
platforms: linux/arm64
88+
tags: gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHORT_SHA }}
89+
push: ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
90+
cache-from: type=gha
91+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG ELIXIR_VERSION=1.18.1
2-
ARG ERLANG_VERSION=27.3
2+
ARG ERLANG_VERSION=27.3.4.12
33
ARG DEBIAN_VERSION=bookworm-20260518-slim
44

55
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-debian-${DEBIAN_VERSION} AS build

0 commit comments

Comments
 (0)