2018-11-15 00:16:03 +00:00
|
|
|
FROM golang:1.11.2 as builder
|
2018-07-15 07:09:51 +00:00
|
|
|
|
2018-09-16 17:40:35 +00:00
|
|
|
EXPOSE 8080
|
|
|
|
|
2018-07-15 07:09:51 +00:00
|
|
|
ENV BUILD_DIR /go/src/github.com/halverneus/static-file-server
|
|
|
|
ENV MAIN github.com/halverneus/static-file-server/bin/serve
|
2018-09-05 17:45:06 +00:00
|
|
|
ENV DEP_VERSION v0.5.0
|
2018-07-15 07:09:51 +00:00
|
|
|
|
|
|
|
RUN curl -fsSL -o /usr/local/bin/dep \
|
2018-07-16 03:52:37 +00:00
|
|
|
https://github.com/golang/dep/releases/download/$DEP_VERSION/dep-linux-amd64 && \
|
2018-07-15 07:09:51 +00:00
|
|
|
chmod +x /usr/local/bin/dep
|
|
|
|
|
|
|
|
RUN mkdir -p ${BUILD_DIR}
|
|
|
|
WORKDIR ${BUILD_DIR}
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN dep ensure -vendor-only
|
2018-07-16 03:52:37 +00:00
|
|
|
RUN go test -race -cover ./...
|
2018-07-15 07:09:51 +00:00
|
|
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /serve ${MAIN}
|
2017-06-23 14:28:11 +00:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /serve /
|
2018-11-15 00:16:03 +00:00
|
|
|
ENTRYPOINT ["/serve"]
|
|
|
|
CMD []
|