tiny-url-ex/Dockerfile

18 lines
361 B
Docker
Raw Normal View History

FROM golang:alpine as builder
ENV GO111MODULE=on
RUN apk add git
ADD . /app
2020-03-08 15:34:00 +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
FROM alpine:latest as production
RUN mkdir /app
2020-03-08 15:34:00 +00:00
COPY --from=builder /app/binary /app
COPY --from=builder /app/api.json /app
WORKDIR /app
EXPOSE 4242/tcp
2020-03-08 15:34:00 +00:00
CMD "/app/binary"