20 lines
431 B
Docker
20 lines
431 B
Docker
FROM golang:1.18-alpine3.15 as go-builder
|
|
ENV GOPATH ""
|
|
|
|
RUN apk add git
|
|
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
|
|
|
WORKDIR /app
|
|
ADD go.mod go.sum ./
|
|
RUN go mod download
|
|
ADD ./ .
|
|
RUN go build -o ./elon .
|
|
|
|
FROM alpine:3.14
|
|
|
|
COPY sql/migrations /app/migrations
|
|
COPY --from=go-builder /app/elon /app/elon
|
|
COPY --from=go-builder /root/go/bin/migrate /bin/migrate
|
|
|
|
ENTRYPOINT ["/app/elon"]
|