use multi-stage docker build to compile in container too

This commit is contained in:
Danny van Kooten 2018-05-10 21:31:30 +02:00
parent 372394ab44
commit ef1efd2c98

View File

@ -1,8 +1,11 @@
FROM alpine:latest
FROM golang:latest AS compiler
WORKDIR /go/src/github.com/usefathom/fathom
ADD . /go/src/github.com/usefathom/fathom
RUN go get -u github.com/gobuffalo/packr/... && make build
FROM alpine:latest
EXPOSE 8080
WORKDIR /app
ADD ./fathom /app/fathom
COPY --from=compiler /go/src/github.com/usefathom/fathom/fathom .
CMD ["./fathom"]
RUN apk add --update bash ca-certificates && rm -rf /var/cache/apk/*