Skip to content

Commit

Permalink
Improve multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Fudeus committed May 19, 2024
1 parent 1cb56ee commit 5eeb38a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
ARG GO_VERSION=1.22
FROM golang:${GO_VERSION} AS builder
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS builder
ARG TARGETARCH
ARG TARGETOS

WORKDIR /build
ADD . /build

ENV CGO_ENABLED=0
RUN go get -u
RUN go build -o /build/apcupsd_exporter /build/cmd/apcupsd_exporter/main.go
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /build/apcupsd_exporter /build/cmd/apcupsd_exporter/main.go
#RUN go install github.com/mdlayher/apcupsd_exporter@main
#RUN go build -o /build/apcupsd_exporter $GOPATH/src/github.com/mdlayher/apcupsd_exporter/cmd/apcupsd_exporter/main.go

Expand Down

0 comments on commit 5eeb38a

Please sign in to comment.