mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Use Docker multi-stage build in Dockerfile
This utilizes Docker multi-stage builds to produce a minimal Docker image. Requires Docker 17.05.0.
This commit is contained in:
parent
df59037942
commit
37d0c4ce23
1 changed files with 9 additions and 7 deletions
16
Dockerfile
16
Dockerfile
|
|
@ -1,4 +1,4 @@
|
|||
FROM golang:1.8.1
|
||||
FROM golang:1.8.1 as builder
|
||||
|
||||
MAINTAINER Pilosa Corp. <dev@pilosa.com>
|
||||
|
||||
|
|
@ -6,9 +6,6 @@ ARG ldflags=''
|
|||
ARG GLIDE="https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz"
|
||||
ARG GLIDE_HASH="d6d3816c70fba716466e7381a9c06cb31565a3b87acb5bad9dd3beb0a9f9b0f8"
|
||||
|
||||
EXPOSE 10101
|
||||
VOLUME /data
|
||||
|
||||
COPY . /go/src/github.com/pilosa/pilosa
|
||||
|
||||
RUN wget ${GLIDE} -O /go/glide.tar.gz -q \
|
||||
|
|
@ -17,9 +14,14 @@ RUN wget ${GLIDE} -O /go/glide.tar.gz -q \
|
|||
&& [ "$(sha256sum /go/bin/glide | cut -d' ' -f1)" = "$GLIDE_HASH" ] \
|
||||
&& cd /go/src/github.com/pilosa/pilosa \
|
||||
&& make vendor \
|
||||
&& CGO_ENABLED=0 go install -a -ldflags "$ldflags" github.com/pilosa/pilosa/cmd/pilosa \
|
||||
&& mv /go/bin/pilosa /pilosa \
|
||||
&& rm -rf /go
|
||||
&& CGO_ENABLED=0 go install -a -ldflags "$ldflags" github.com/pilosa/pilosa/cmd/pilosa
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /go/bin/pilosa /pilosa
|
||||
|
||||
EXPOSE 10101
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["/pilosa"]
|
||||
CMD ["server", "--data-dir", "/data"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue