dep: use dep in Dockerfile

This commit is contained in:
Equim 2018-02-24 21:48:34 +08:00
parent c300d33c2c
commit 5f5237248f
No known key found for this signature in database
GPG Key ID: 0534B6F897D268E7

View File

@ -1,24 +1,25 @@
FROM golang:alpine
FROM golang:alpine
COPY . /go/src/github.com/filebrowser/filebrowser
COPY . /go/src/github.com/filebrowser/filebrowser
WORKDIR /go/src/github.com/filebrowser/filebrowser
WORKDIR /go/src/github.com/filebrowser/filebrowser RUN apk add --no-cache git curl && \
RUN apk add --no-cache git curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 && \
RUN go get ./... chmod +x /usr/local/bin/dep
RUN dep ensure -vendor-only
WORKDIR /go/src/github.com/filebrowser/filebrowser/cmd/filebrowser
RUN CGO_ENABLED=0 go build -a WORKDIR /go/src/github.com/filebrowser/filebrowser/cmd/filebrowser
RUN mv filebrowser /go/bin/filebrowser RUN CGO_ENABLED=0 go build -a
RUN mv filebrowser /go/bin/filebrowser
FROM scratch
COPY --from=0 /go/bin/filebrowser /filebrowser FROM scratch
COPY --from=0 /go/bin/filebrowser /filebrowser
VOLUME /tmp
VOLUME /srv VOLUME /tmp
EXPOSE 80 VOLUME /srv
EXPOSE 80
COPY Docker.json /config.json
COPY Docker.json /config.json
ENTRYPOINT ["/filebrowser"]
CMD ["--config", "/config.json"] ENTRYPOINT ["/filebrowser"]
CMD ["--config", "/config.json"]