Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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
FROM scratch

COPY --from=build-env /go/src/github.com/mintance/nginx-clickhouse/nginx-clickhouse /
CMD [ "/nginx-clickhouse" ]

7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 .
docker build --rm --no-cache=true -e GOAMD64=$(GOAMD64) -build-arg GolangVersion=$(GolangVersion) -t mintance/nginx-clickhouse -f Dockerfile .