forked from golang-migrate/migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
29 lines (20 loc) · 841 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM golang:1.10-alpine3.7 AS downloader
ARG VERSION
RUN apk add --no-cache git gcc musl-dev
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 *.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
FROM alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=downloader /go/src/github.com/golang-migrate/migrate/build/migrate.linux-386 /migrate
RUN chmod u+x /migrate
ENTRYPOINT ["/migrate"]
CMD ["--help"]