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
|
|
|
|
WORKDIR /app
|
2019-05-01 15:25:57 +00:00
|
|
|
RUN go get -d ./...
|
2020-03-03 19:02:15 +00:00
|
|
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o tiny-url
|
2019-05-01 15:25:57 +00:00
|
|
|
|
2020-03-03 19:02:15 +00:00
|
|
|
FROM alpine:latest as production
|
|
|
|
RUN mkdir /app
|
|
|
|
COPY --from=builder /app/tiny-url /app
|
|
|
|
COPY --from=builder /app/api.json /app
|
|
|
|
|
|
|
|
WORKDIR /app
|
2019-05-01 15:25:57 +00:00
|
|
|
EXPOSE 4242/tcp
|
2020-03-03 19:02:15 +00:00
|
|
|
CMD "/app/tiny-url"
|