Add build args
args: operating system (OS) and architecture (ARCH)
This commit is contained in:
parent
045639e0ee
commit
70b98b603b
1 changed files with 4 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
FROM golang:alpine as builder
|
||||
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
|
||||
WORKDIR /go/src/github.com/eko/pihole-exporter
|
||||
COPY . .
|
||||
|
||||
|
@ -7,7 +10,7 @@ RUN apk update && \
|
|||
apk --no-cache add git alpine-sdk upx
|
||||
|
||||
RUN GO111MODULE=on go mod vendor
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-s -w' -o binary ./
|
||||
RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -ldflags '-s -w' -o binary ./
|
||||
RUN upx -f --brute binary
|
||||
|
||||
FROM scratch
|
||||
|
|
Loading…
Reference in a new issue