articles-api/Dockerfile

17 lines
349 B
Docker

FROM golang:alpine as builder
ENV GO111MODULE=on
RUN apk add git
ADD . /app
WORKDIR /app
RUN go get -d ./...
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o tiny-url
FROM alpine:latest as production
RUN mkdir /app
COPY --from=builder /app/tiny-url /app
COPY --from=builder /app/api.json /app
WORKDIR /app
EXPOSE 4242/tcp
CMD "/app/tiny-url"