Dockerize migrations

This commit is contained in:
Edvard 2019-01-24 17:13:55 +01:00
parent d3550357d1
commit 1602100ed4
2 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,6 @@
.travis.yml
.idea
bin
db
.gitignore
environments
integration_test
@ -15,4 +14,5 @@ Supfile
test_config
.travis.yml
vulcanizedb.log
Dockerfile

View File

@ -7,8 +7,15 @@ ADD . /go/src/github.com/vulcanize/vulcanizedb
WORKDIR /go/src/github.com/vulcanize/vulcanizedb
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' .
# Build migration tool
RUN go get -u -d github.com/pressly/goose/cmd/goose
WORKDIR /go/src/github.com/pressly/goose/cmd/goose
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -tags='no_mysql no_sqlite' -o goose
# Second stage
FROM scratch
FROM alpine
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/vulcanizedb /app/vulcanizedb
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose /app/goose
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/db/migrations/* /app/
WORKDIR /app
CMD ["./vulcanizedb", "--help"]
CMD ["./goose"]