From 9f4ce86efd000cdc717f41e3a4f6bf09d98f5b57 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 21 Feb 2024 20:08:26 +0000 Subject: [PATCH] Cross-compile for aarch64 instead of amd64 --- .drone.yml | 6 ++++-- Containerfile | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 10203ef..cc074d6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,7 +2,7 @@ kind: pipeline name: default steps: -- name: docker +- name: docker_aarch64 image: plugins/docker settings: registry: atdr-writer.meo.ws @@ -14,5 +14,7 @@ steps: dockerfile: Containerfile purge: true auto_tag: false + build_args: + - GOARCH=aarch64 tags: - - latest + - ${DRONE_BRANCH}-aarch64 diff --git a/Containerfile b/Containerfile index 251b626..01075d8 100644 --- a/Containerfile +++ b/Containerfile @@ -12,7 +12,9 @@ WORKDIR /go/src/github.com/dutchcoders/transfer.sh ENV GO111MODULE=on # build & install server -RUN go get ./... && CGO_ENABLED=0 go build -ldflags -a -tags netgo -ldflags '-w -extldflags "-static"' -o /go/bin/transfersh github.com/dutchcoders/transfer.sh +ARG GOOS=linux +ARG GOARCH=amd64 +RUN go get ./... && CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags -a -tags netgo -ldflags '-w -extldflags "-static"' -o /go/bin/transfersh github.com/dutchcoders/transfer.sh FROM scratch AS final LABEL maintainer="Andrea Spacca "