# Building... FROM golang:alpine as server-builder WORKDIR /elections RUN apk update && apk upgrade && \ apk add --no-cache bash git openssh build-base ADD . . RUN go version RUN go get -d -v && \ go test ./... && \ go build # Running... FROM alpine WORKDIR /app RUN apk update && apk add ca-certificates libcap mailcap # ca-certificates for autocert (Let's Encrypt) and mailcap to get mime types for downloaded documents COPY --from=server-builder /elections/elections /app COPY --from=server-builder /elections/dev_certificates /app/dev_certificates COPY --from=server-builder /elections/web /app/web COPY --from=server-builder /elections/configs /app/configs RUN setcap cap_net_bind_service=+ep elections ENTRYPOINT [ "./elections"]