Go v1.11 (#60)

* Go v1.11
* [Go Modules](https://github.com/golang/go/wiki/Modules)
* [GolangCI-Lint](https://github.com/golangci/golangci-lint)
* [Distroless](https://github.com/GoogleContainerTools/distroless) docker image
This commit is contained in:
Adrian Macneil 2018-12-01 22:28:47 -08:00 committed by GitHub
parent abc544b368
commit da3d9525cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 117 deletions

View file

@ -1,5 +1,5 @@
# build image
FROM golang:1.10 as build
FROM golang:1.11 as build
# required to force cgo (for sqlite driver) with cross compile
ENV CGO_ENABLED 1
@ -13,21 +13,17 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
# development dependencies
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 \
&& chmod +x /usr/local/bin/dep
RUN go get gopkg.in/alecthomas/gometalinter.v2 \
&& gometalinter.v2 --install
RUN curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s v1.12.3
# copy source files
COPY . /go/src/github.com/amacneil/dbmate
WORKDIR /go/src/github.com/amacneil/dbmate
COPY . /src
WORKDIR /src
# build
RUN make dep install build
RUN make build
# runtime image
FROM debian:stretch-slim
COPY --from=build /go/src/github.com/amacneil/dbmate/dist/dbmate-linux-amd64 \
/usr/local/bin/dbmate
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/dbmate"]
FROM gcr.io/distroless/base
COPY --from=build /src/dist/dbmate-linux-amd64 /dbmate
ENTRYPOINT ["/dbmate"]