tiny-url-ex/Dockerfile

18 lines
361 B
Docker

FROM golang:alpine as builder
ENV GO111MODULE=on
RUN apk add git
ADD . /app
WORKDIR /app
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
COPY --from=builder /app/binary /app
COPY --from=builder /app/api.json /app
WORKDIR /app
EXPOSE 4242/tcp
CMD "/app/binary"