Skip to content

Commit 58ea890

Browse files
authored
Use native ARM builder for aarch64 image (#251)
* Use native ARM builder for aarch64 image * Don't pin builder arch, remove unsupported architectures from Dockerfile
1 parent ff7cc34 commit 58ea890

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.github/workflows/builder.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ jobs:
4646
build:
4747
name: Build ${{ matrix.arch }} plugin
4848
needs: init
49-
runs-on: ubuntu-latest
49+
runs-on: ${{ matrix.runs-on }}
5050
permissions:
5151
contents: read
5252
packages: write
5353
id-token: write
5454
strategy:
5555
matrix:
5656
arch: ${{ fromJson(needs.init.outputs.architectures) }}
57+
include:
58+
- runs-on: ubuntu-24.04
59+
- arch: aarch64
60+
runs-on: ubuntu-24.04-arm
5761
steps:
5862
- name: Checkout the repository
5963
uses: actions/checkout@v6.0.2
@@ -73,6 +77,7 @@ jobs:
7377
- name: Build plugin
7478
uses: home-assistant/builder@2025.11.0
7579
with:
80+
image: ${{ matrix.arch }}
7681
args: |
7782
$BUILD_ARGS \
7883
--${{ matrix.arch }} \

Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BUILD_FROM
22

3-
FROM --platform=amd64 golang:1.24-alpine3.22 AS builder
3+
FROM golang:1.24-alpine3.22 AS builder
44

55
WORKDIR /workspace/observer-plugin
66
ARG BUILD_ARCH
@@ -9,14 +9,8 @@ COPY . .
99

1010
# Build
1111
RUN \
12-
if [ "${BUILD_ARCH}" = "armhf" ]; then \
13-
CGO_ENABLED=0 GOARM=6 GOARCH=arm go build -ldflags="-s -w"; \
14-
elif [ "${BUILD_ARCH}" = "armv7" ]; then \
15-
CGO_ENABLED=0 GOARM=7 GOARCH=arm go build -ldflags="-s -w"; \
16-
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \
12+
if [ "${BUILD_ARCH}" = "aarch64" ]; then \
1713
CGO_ENABLED=0 GOARCH=arm64 go build -ldflags="-s -w"; \
18-
elif [ "${BUILD_ARCH}" = "i386" ]; then \
19-
CGO_ENABLED=0 GOARCH=386 go build -ldflags="-s -w"; \
2014
elif [ "${BUILD_ARCH}" = "amd64" ]; then \
2115
CGO_ENABLED=0 GOARCH=amd64 go build -ldflags="-s -w"; \
2216
else \

0 commit comments

Comments
 (0)