From cbf58d69e950d761ea5676e9e02b0f91a1b586d9 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Mon, 17 Sep 2018 11:53:39 +0800 Subject: [PATCH] Update Dockerfile --- Dockerfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c1fa01..508bda1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,31 @@ FROM golang:1.11-rc-alpine as build -RUN apk add --no-cache git=2.18.0-r0 ca-certificates +ARG version="3.5.2" +ARG databases="cassandra clickhouse cockroachdb crate mongodb mysql neo4j postgres ql redshift shell spanner sqlite3 stub testing" + +RUN apk add --no-cache git ca-certificates RUN wget -O /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && chmod +x /usr/local/bin/dep -RUN go get -u -d github.com/golang-migrate/migrate/cli +RUN git clone https://github.com/golang-migrate/migrate -b "v${version}" $GOPATH/src/github.com/golang-migrate/migrate +WORKDIR $GOPATH/src/github.com/golang-migrate/migrate +RUN git checkout -b "v${version}" + WORKDIR $GOPATH/src/github.com/golang-migrate/migrate/cli RUN dep ensure -RUN CGO_ENABLED=0 go build -ldflags "-s -w" -tags 'cassandra clickhouse cockroachdb crate mongodb mysql neo4j postgres ql redshift shell spanner sqlite3 stub testing' -o /migrate +RUN CGO_ENABLED=0 go build -ldflags "-s -w" -tags '${databases}' -o /migrate FROM scratch +# labels +LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/migrate" +LABEL org.label-schema.version=${version} +LABEL org.label-schema.schema-version="1.0" + WORKDIR / -COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=build /migrate /migrate +COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt ENTRYPOINT ["/migrate"]