You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
936B

  1. FROM golang:1.11-rc-alpine as build
  2. # args
  3. ARG version="4.2.5"
  4. ARG databases="cassandra clickhouse cockroachdb crate mongodb mysql neo4j postgres ql redshift shell spanner sqlite3 stub testing"
  5. # dependencies
  6. RUN apk add --no-cache git ca-certificates
  7. # source
  8. RUN git clone https://github.com/golang-migrate/migrate -b "v${version}" /src/migrate
  9. WORKDIR /src/migrate
  10. # dependencies
  11. RUN go get
  12. WORKDIR /src/migrate/cli
  13. # build
  14. ENV CGO_ENABLED=0
  15. ENV GOOS=linux
  16. ENV GOARCH=amd64
  17. RUN go build -ldflags "-s -w" -tags "${databases}" -o /migrate
  18. FROM scratch
  19. ARG version
  20. # labels
  21. LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/migrate"
  22. LABEL org.label-schema.version=${version}
  23. LABEL org.label-schema.schema-version="1.0"
  24. # copy binary and ca certs
  25. COPY --from=build /migrate /migrate
  26. COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
  27. WORKDIR /
  28. ENTRYPOINT ["/migrate"]