Skip to content

Commit

Permalink
Backport(v1.16): Enable arm host (#416) (#417)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kenhys authored Jan 31, 2025
1 parent 98edd7d commit ab4f867
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
done
build:
needs: define-matrix
runs-on: ubuntu-latest
runs-on: >-
${{ (contains(matrix.component, 'arm64')) && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
Expand Down
12 changes: 1 addition & 11 deletions Dockerfile.template.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ COPY --from=builder /go/qemu-arm-static /usr/bin/
<% elsif is_arm64 %>
# To set multiarch build for Docker hub automated build.
FROM golang:alpine AS builder
WORKDIR /go
ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8
RUN apk add curl --no-cache
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 .

FROM --platform=linux/arm64 arm64v8/ruby:3.2-slim-bookworm
COPY --from=builder /go/qemu-aarch64-static /usr/bin/
<% else %>
FROM ruby:3.2-slim-bookworm
<% end %>
Expand All @@ -52,10 +46,6 @@ LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="<
ARG CROSS_BUILD_START="cross-build-start"
ARG CROSS_BUILD_END="cross-build-end"
RUN [ ${CROSS_BUILD_START} ]
<% elsif is_arm64 %>
ARG CROSS_BUILD_START="cross-build-start"
ARG CROSS_BUILD_END="cross-build-end"
RUN [ ${CROSS_BUILD_START} ]
<% end %>
<% if not is_alpine %>
<% if is_armhf %>
Expand Down Expand Up @@ -192,7 +182,7 @@ USER fluent
ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"]
CMD ["fluentd"]

<% if is_armhf || is_arm64 %>
<% if is_armhf %>
RUN [ ${CROSS_BUILD_END} ]
<% end %>
<% end %>
10 changes: 0 additions & 10 deletions v1.16/arm64/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@

# To set multiarch build for Docker hub automated build.
FROM golang:alpine AS builder
WORKDIR /go
ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8
RUN apk add curl --no-cache
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 .

FROM --platform=linux/arm64 arm64v8/ruby:3.2-slim-bookworm
COPY --from=builder /go/qemu-aarch64-static /usr/bin/
LABEL maintainer "Fluentd developers <[email protected]>"
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.16.7"
ARG CROSS_BUILD_START="cross-build-start"
ARG CROSS_BUILD_END="cross-build-end"
RUN [ ${CROSS_BUILD_START} ]
ENV TINI_VERSION=0.18.0

# Do not split this into multiple RUN!
Expand Down Expand Up @@ -78,4 +69,3 @@ USER fluent
ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"]
CMD ["fluentd"]

RUN [ ${CROSS_BUILD_END} ]

0 comments on commit ab4f867

Please sign in to comment.