2018-09-05 05:18:49 +00:00
|
|
|
FROM golang:1.11-alpine3.8 AS downloader
|
2018-05-09 21:26:37 +00:00
|
|
|
ARG VERSION
|
2018-05-08 19:13:53 +00:00
|
|
|
|
2018-10-10 23:11:44 +00:00
|
|
|
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
|
2018-05-08 19:13:53 +00:00
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/golang-migrate/migrate
|
|
|
|
|
2018-10-10 23:11:44 +00:00
|
|
|
COPY Gopkg.toml Gopkg.lock ./
|
|
|
|
RUN dep ensure -vendor-only
|
|
|
|
|
|
|
|
COPY *.go ./
|
|
|
|
COPY cli ./cli
|
|
|
|
COPY database ./database
|
|
|
|
COPY source ./source
|
2018-05-08 19:13:53 +00:00
|
|
|
|
2018-10-10 22:09:03 +00:00
|
|
|
ENV GO111MODULE=on
|
2018-06-11 11:18:05 +00:00
|
|
|
ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse"
|
2018-06-12 08:18:27 +00:00
|
|
|
ENV SOURCES="file go_bindata github aws_s3 google_cloud_storage"
|
2018-06-11 11:18:05 +00:00
|
|
|
|
|
|
|
RUN go build -a -o build/migrate.linux-386 -ldflags="-X main.Version=${VERSION}" -tags "$DATABASES $SOURCES" ./cli
|
2018-05-08 19:13:53 +00:00
|
|
|
|
2018-09-05 05:18:49 +00:00
|
|
|
FROM alpine:3.8
|
2018-05-08 19:13:53 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
|
|
|
|
COPY --from=downloader /go/src/github.com/golang-migrate/migrate/build/migrate.linux-386 /migrate
|
|
|
|
|
|
|
|
ENTRYPOINT ["/migrate"]
|
2018-06-11 11:18:05 +00:00
|
|
|
CMD ["--help"]
|