Docker alpine

mangalaman93 commented :

For now, you could use the following Dockerfile for creating an alpine based image. We will see if it is possible to add this to official docker images.

######################
# STEP 1 build dgraph
######################
FROM golang:1.12-alpine3.9 AS builder

# build custom branch
ARG DGRAPH_BRANCH=master

# Install git
RUN apk update && apk add --no-cache git

# build dgraph binary
RUN go get -d -v github.com/dgraph-io/dgraph/dgraph
RUN cd $GOPATH/src/github.com/dgraph-io/dgraph && git checkout ${DGRAPH_BRANCH}
RUN CGO_ENABLED=0 go build -v -o /dgraph github.com/dgraph-io/dgraph/dgraph

#####################
# STEP 2 build image
#####################
FROM alpine

COPY --from=builder /dgraph /usr/local/bin/dgraph

RUN mkdir /dgraph
WORKDIR /dgraph

EXPOSE 8080
EXPOSE 9080

CMD ["dgraph"]