From 2df9a07cee585131f1f38c9964dafb1cca32dded Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Wed, 11 Sep 2019 10:25:21 +0100 Subject: [PATCH] Fix Dockerfile to work with modules Also use the latest Go release to build the code. --- Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 180b9f8..cff2d88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,8 @@ -FROM golang:1.12-alpine as builder +FROM golang:1.13-alpine as builder -ADD https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 /usr/bin/dep -RUN chmod +x /usr/bin/dep -RUN apk --no-cache --update add git -WORKDIR $GOPATH/src/github.com/heetch/regula -COPY Gopkg.toml Gopkg.lock ./ -RUN dep ensure --vendor-only -COPY . ./ -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /regula ./cmd/regula +WORKDIR /src/regula +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /regula ./cmd/regula RUN chmod +x /regula CMD ["/regula"]