From cb0821f7d13cfd88adc9cf97ade2c167fc4c6bc2 Mon Sep 17 00:00:00 2001 From: Andrei Neustroev Date: Thu, 12 May 2022 13:52:45 +0500 Subject: [PATCH 1/2] Add golang args --- Dockerfile | 6 +++--- Makefile | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5147faa..c726159 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ +ARG GolangVersion=1.17-alpine # build stage -FROM golang:1.17-alpine AS build-env +FROM golang:${GolangVersion} AS build-env WORKDIR /go/src/github.com/mintance/nginx-clickhouse ADD . /go/src/github.com/mintance/nginx-clickhouse RUN apk update && apk add make g++ git curl -RUN cd /go/src/github.com/mintance/nginx-clickhouse && go get . +RUN cd /go/src/github.com/mintance/nginx-clickhouse && go get . RUN cd /go/src/github.com/mintance/nginx-clickhouse && make build # final stage @@ -14,4 +15,3 @@ FROM scratch COPY --from=build-env /go/src/github.com/mintance/nginx-clickhouse/nginx-clickhouse / CMD [ "/nginx-clickhouse" ] - diff --git a/Makefile b/Makefile index 3cd05c2..9192e64 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ +GolangVersion = 1.17.1-buster +GOAMD64 = v3 + build: go mod vendor - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o nginx-clickhouse . + CGO_ENABLED=0 GOOS=linux GOAMD64=$(GOAMD64) go build -a -installsuffix cgo -o nginx-clickhouse . docker: - docker build --rm --no-cache=true -t mintance/nginx-clickhouse -f Dockerfile . \ No newline at end of file + docker build --rm --no-cache=true -e GOAMD64=$(GOAMD64) -t mintance/nginx-clickhouse -f Dockerfile . \ No newline at end of file From e7c18faaf3d55337b5ba98b82ee9dc05f6336fa0 Mon Sep 17 00:00:00 2001 From: Andrei Neustroev Date: Thu, 12 May 2022 13:57:45 +0500 Subject: [PATCH 2/2] Add golabg image version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9192e64..5c20485 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,4 @@ build: CGO_ENABLED=0 GOOS=linux GOAMD64=$(GOAMD64) go build -a -installsuffix cgo -o nginx-clickhouse . docker: - docker build --rm --no-cache=true -e GOAMD64=$(GOAMD64) -t mintance/nginx-clickhouse -f Dockerfile . \ No newline at end of file + docker build --rm --no-cache=true -e GOAMD64=$(GOAMD64) -build-arg GolangVersion=$(GolangVersion) -t mintance/nginx-clickhouse -f Dockerfile . \ No newline at end of file