2019-05-01 15:25:57 +00:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
RUN apk add git
|
2020-03-03 19:02:15 +00:00
|
|
|
ADD . /app
|
2020-03-08 15:34:00 +00:00
|
|
|
|
2020-03-03 19:02:15 +00:00
|
|
|
WORKDIR /app
|
2020-03-08 15:34:00 +00:00
|
|
|
RUN go mod download
|
|
|
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o binary
|
2019-05-01 15:25:57 +00:00
|
|
|
|
2020-03-03 19:02:15 +00:00
|
|
|
FROM alpine:latest as production
|
|
|
|
RUN mkdir /app
|
2020-03-08 15:34:00 +00:00
|
|
|
COPY --from=builder /app/binary /app
|
2020-03-03 19:02:15 +00:00
|
|
|
COPY --from=builder /app/api.json /app
|
|
|
|
|
|
|
|
WORKDIR /app
|
2019-05-01 15:25:57 +00:00
|
|
|
EXPOSE 4242/tcp
|
2020-03-08 15:34:00 +00:00
|
|
|
CMD "/app/binary"
|