Skip to content

Commit d95b424

Browse files
authored
github: Use arm host to build arm64 image (#416)
As QEMU on amd64 for building arm64 image cause SEGV issue, let's try to use arm64 runner directly. Signed-off-by: Kentaro Hayashi <[email protected]>
1 parent 89d5c78 commit d95b424

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

.github/workflows/docker-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
done
4040
build:
4141
needs: define-matrix
42-
runs-on: ubuntu-latest
42+
runs-on: >-
43+
${{ (contains(matrix.component, 'arm64')) && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
4344
strategy:
4445
fail-fast: false
4546
matrix:

Dockerfile.template.erb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ COPY --from=builder /go/qemu-arm-static /usr/bin/
3434
<% elsif is_arm64 %>
3535
# To set multiarch build for Docker hub automated build.
3636
FROM golang:alpine AS builder
37-
WORKDIR /go
38-
ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8
39-
RUN apk add curl --no-cache
40-
RUN curl -sL -o qemu-6.0.0.balena1-aarch64.tar.gz https://github.com/balena-io/qemu/releases/download/v6.0.0%2Bbalena1/qemu-6.0.0.balena1-aarch64.tar.gz && echo "$QEMU_DOWNLOAD_SHA256 *qemu-6.0.0.balena1-aarch64.tar.gz" | sha256sum -c - | tar zxvf qemu-6.0.0.balena1-aarch64.tar.gz -C . && mv qemu-6.0.0+balena1-aarch64/qemu-aarch64-static .
41-
4237
FROM --platform=linux/arm64 arm64v8/ruby:3.2-slim-bookworm
43-
COPY --from=builder /go/qemu-aarch64-static /usr/bin/
4438
<% else %>
4539
FROM ruby:3.2-slim-bookworm
4640
<% end %>
@@ -52,10 +46,6 @@ LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="<
5246
ARG CROSS_BUILD_START="cross-build-start"
5347
ARG CROSS_BUILD_END="cross-build-end"
5448
RUN [ ${CROSS_BUILD_START} ]
55-
<% elsif is_arm64 %>
56-
ARG CROSS_BUILD_START="cross-build-start"
57-
ARG CROSS_BUILD_END="cross-build-end"
58-
RUN [ ${CROSS_BUILD_START} ]
5949
<% end %>
6050

6151
# Do not split this into multiple RUN!
@@ -183,7 +173,7 @@ USER fluent
183173
ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"]
184174
CMD ["fluentd"]
185175

186-
<% if is_armhf || is_arm64 %>
176+
<% if is_armhf %>
187177
RUN [ ${CROSS_BUILD_END} ]
188178
<% end %>
189179
<% end %>

v1.18/arm64/debian/Dockerfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,9 @@
33

44
# To set multiarch build for Docker hub automated build.
55
FROM golang:alpine AS builder
6-
WORKDIR /go
7-
ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8
8-
RUN apk add curl --no-cache
9-
RUN curl -sL -o qemu-6.0.0.balena1-aarch64.tar.gz https://github.com/balena-io/qemu/releases/download/v6.0.0%2Bbalena1/qemu-6.0.0.balena1-aarch64.tar.gz && echo "$QEMU_DOWNLOAD_SHA256 *qemu-6.0.0.balena1-aarch64.tar.gz" | sha256sum -c - | tar zxvf qemu-6.0.0.balena1-aarch64.tar.gz -C . && mv qemu-6.0.0+balena1-aarch64/qemu-aarch64-static .
10-
116
FROM --platform=linux/arm64 arm64v8/ruby:3.2-slim-bookworm
12-
COPY --from=builder /go/qemu-aarch64-static /usr/bin/
137
LABEL maintainer "Fluentd developers <[email protected]>"
148
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.18.0"
15-
ARG CROSS_BUILD_START="cross-build-start"
16-
ARG CROSS_BUILD_END="cross-build-end"
17-
RUN [ ${CROSS_BUILD_START} ]
189

1910
# Do not split this into multiple RUN!
2011
# Docker creates a layer for every RUN-Statement
@@ -75,4 +66,3 @@ USER fluent
7566
ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"]
7667
CMD ["fluentd"]
7768

78-
RUN [ ${CROSS_BUILD_END} ]

0 commit comments

Comments
 (0)