Add Dockerfile

This commit is contained in:
Rob Watson 2022-07-15 04:41:15 +02:00
parent 731652dcb3
commit 80da073ae2
1 changed files with 21 additions and 0 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
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 ./solar-toolkit-daemon ./cmd/daemon
RUN go build -o ./solar-toolkit-gateway ./cmd/gateway
FROM alpine:3.15
COPY gateway/sql/migrations /app/migrations
COPY --from=go-builder /app/solar-toolkit-gateway /app/solar-toolkit-gateway
COPY --from=go-builder /app/solar-toolkit-daemon /app/solar-toolkit-daemon
COPY --from=go-builder /root/go/bin/migrate /bin/migrate
ENTRYPOINT ["/app/solar-toolkit-gateway"]