static-file-server/Dockerfile

24 lines
590 B
Docker
Raw Normal View History

2018-10-16 22:39:25 +00:00
FROM golang:1.11.1 as builder
2018-09-16 17:40:35 +00:00
EXPOSE 8080
ENV BUILD_DIR /go/src/github.com/halverneus/static-file-server
ENV MAIN github.com/halverneus/static-file-server/bin/serve
ENV DEP_VERSION v0.5.0
RUN curl -fsSL -o /usr/local/bin/dep \
https://github.com/golang/dep/releases/download/$DEP_VERSION/dep-linux-amd64 && \
chmod +x /usr/local/bin/dep
RUN mkdir -p ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY . .
RUN dep ensure -vendor-only
RUN go test -race -cover ./...
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 /
CMD ["/serve"]