Use dep to build docker image

This commit is contained in:
Dale Hui 2018-06-11 19:18:05 +08:00
parent 387f79be13
commit 0d9f636356
1 changed files with 10 additions and 8 deletions

View File

@ -1,22 +1,24 @@
FROM golang:1.10-alpine3.7 AS downloader
ARG VERSION
RUN apk add --no-cache git gcc musl-dev
RUN apk add --no-cache git gcc musl-dev curl
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 && chmod +x /usr/local/bin/dep
WORKDIR /go/src/github.com/golang-migrate/migrate
ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse"
ENV SOURCES="file go-bindata github aws-s3 google-cloud-storage"
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure -vendor-only
COPY *.go ./
COPY cli ./cli
COPY database ./database
COPY source ./source
RUN go get -v ./... && \
go get -u github.com/fsouza/fake-gcs-server/fakestorage && \
go get -u github.com/kshvakov/clickhouse && \
go build -a -o build/migrate.linux-386 -ldflags="-X main.Version=${VERSION}" -tags "$DATABASES $SOURCES" ./cli
ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse"
ENV SOURCES="file go-bindata github aws-s3 google-cloud-storage"
RUN go build -a -o build/migrate.linux-386 -ldflags="-X main.Version=${VERSION}" -tags "$DATABASES $SOURCES" ./cli
FROM alpine:3.7