Skip to content

Commit

Permalink
Merge pull request #191 from isZumpo/fix_docker_arm64
Browse files Browse the repository at this point in the history
Fix arm64 cross compilation in docker build on amd64
  • Loading branch information
tphakala authored Jun 3, 2024
2 parents 9cb1c1e + b96b50b commit d6519a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \
git \
sudo \
zip \
gcc-aarch64-linux-gnu \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /root/src
Expand Down Expand Up @@ -43,7 +44,13 @@ COPY . BirdNET-Go
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
cd BirdNET-Go && make TARGETPLATFORM=${TARGETPLATFORM}
PLATFORM='unknown'; \
case "${TARGETPLATFORM}" in \
"linux/amd64") PLATFORM='linux_amd64' ;; \
"linux/arm64") PLATFORM='linux_arm64' ;; \
*) echo "Unsupported platform: '${TARGETPLATFORM}'" && exit 1 ;; \
esac; \
cd BirdNET-Go && make ${PLATFORM}

# Create final image using a multi-platform base image
FROM debian:bookworm-slim
Expand Down

0 comments on commit d6519a6

Please sign in to comment.