From 3e065e886fb91a67e33ece3425f65aeb8236f136 Mon Sep 17 00:00:00 2001 From: zweihander <42911384+zweihander@users.noreply.github.com> Date: Mon, 5 Oct 2020 01:46:37 +0500 Subject: [PATCH] update Dockerfile (#97) --- Dockerfile | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index c6d71b2..8f11c7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,19 @@ -FROM golang:1.12-alpine - -WORKDIR /etc -ADD . . -RUN apk update && \ - apk add git make clang build-base pkgconfig openssh cmake libssh2 libssh2-dev openssl bash ninja -RUN go get -u -d -v . -RUN ./install.sh -RUN ./gitql -v -RUN echo "INSTALLED " $TARGET_OS_ARCH +# run with: +# docker build -t gitql . +# docker run -it --entrypoint /bin/sh gitql:latest + +FROM golang:1.15.2-alpine3.12 as builder + +WORKDIR /src +COPY go.mod . +COPY go.sum . +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/gitql + +FROM alpine:3.12 +RUN apk add -U git +COPY --from=builder /bin/gitql /bin/ + +ENTRYPOINT ["gitql"] \ No newline at end of file