Dockerfile: Add golang-migrate

This commit is contained in:
Rob Watson 2022-05-22 19:59:20 +02:00
parent 1816d0be4b
commit b4f00d6f2d
1 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@ FROM golang:1.18-alpine3.15 as go-builder
ENV GOPATH "" ENV GOPATH ""
RUN apk add git RUN apk add git
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
WORKDIR /app WORKDIR /app
ADD go.mod go.sum ./ ADD go.mod go.sum ./
@ -11,6 +12,8 @@ RUN go build -o ./elon .
FROM alpine:3.14 FROM alpine:3.14
COPY sql/migrations /app/migrations
COPY --from=go-builder /app/elon /app/elon COPY --from=go-builder /app/elon /app/elon
COPY --from=go-builder /root/go/bin/migrate /bin/migrate
ENTRYPOINT ["/app/elon"] ENTRYPOINT ["/app/elon"]