diff --git a/contrib/standalone/Dockerfile b/contrib/standalone/Dockerfile index a0c964de9d2..f023bad1be9 100644 --- a/contrib/standalone/Dockerfile +++ b/contrib/standalone/Dockerfile @@ -1,4 +1,5 @@ -FROM dgraph/dgraph:latest +ARG DGRAPH_VERSION=latest +FROM dgraph/dgraph:${DGRAPH_VERSION} LABEL MAINTAINER="Dgraph Labs " # Ratel port diff --git a/contrib/standalone/Dockerfile.master b/contrib/standalone/Dockerfile.master deleted file mode 100644 index cc6bd4f20da..00000000000 --- a/contrib/standalone/Dockerfile.master +++ /dev/null @@ -1,13 +0,0 @@ -FROM dgraph/dgraph:master -LABEL MAINTAINER="Dgraph Labs " - -# Ratel port -EXPOSE 8000 -# REST API port -EXPOSE 8080 -# gRPC API port -EXPOSE 9080 - -ADD run.sh . -RUN chmod +x run.sh -CMD ["./run.sh"] diff --git a/contrib/standalone/Makefile b/contrib/standalone/Makefile index 0db31ad1daf..b06c1e730b6 100644 --- a/contrib/standalone/Makefile +++ b/contrib/standalone/Makefile @@ -1,3 +1,38 @@ -.PHONY: build +# Build dgraph/standalone image +# Usage: +# +# For latest tag: +# Build, based on dgraph/dgraph:latest: +# make +# Push: +# make push +# +# For $TAG tag, set DGRAPH_VERSION: +# Build, based on dgraph/dgraph:latest: +# make DGRAPH_VERSION=$TAG +# Push: +# make DGRAPH_VERSION=$TAG push +# +# Examples +# Build and push latest: +# make +# make push +# +# Build and push master: +# make DGRAPH_VERSION=master +# make DGRAPH_VERSION=master push +# +.PHONY: all build push version + +export DGRAPH_VERSION ?= latest + +all: build version + build: - docker build -t dgraph/standalone:latest . + ./hooks/build + +push: + docker push dgraph/standalone:$(DGRAPH_VERSION) + +version: + docker run dgraph/standalone:$(DGRAPH_VERSION) dgraph version diff --git a/contrib/standalone/hooks/build b/contrib/standalone/hooks/build new file mode 100755 index 00000000000..c9af4522026 --- /dev/null +++ b/contrib/standalone/hooks/build @@ -0,0 +1,3 @@ +#!/bin/bash +# Used for Makefile or Docker Hub builds +docker build -t dgraph/standalone:${DGRAPH_VERSION} --build-arg DGRAPH_VERSION=${DGRAPH_VERSION} .