From 70b98b603b61152a98332a8a149a6812fd7000b4 Mon Sep 17 00:00:00 2001 From: Sidd Shah Date: Fri, 3 Apr 2020 23:45:49 -0400 Subject: [PATCH] Add build args args: operating system (OS) and architecture (ARCH) --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b89b538..fbc79d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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