Skip to content

Commit

Permalink
build(standalone): Add DGRAPH_VERSION to build different Dgraph versi…
Browse files Browse the repository at this point in the history
…ons for standalone image. (#6082) (#6237)

The standalone images build from the same tags as the `dgraph/dgraph` image.

To build and push the v20.03.4 and latest `dgraph/standalone` images:

    # Build v20.03.4
    make DGRAPH_VERSION=v20.03.4
    make DGRAPH_VERSION=v20.03.4 push

    # Build latest. DGRAPH_VERSION defaults to latest
    make
    make push

Changes
* Add `DOCKER_IMAGE` and `DGRAPH_VERSION` arguments to build standalone Docker image.
* Add ./hooks folder for Docker Hub auto-builds with `--build-arg`s (following [Custom build phase hooks](https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks) docs).
  • Loading branch information
danielmai committed Aug 18, 2020
1 parent 6741237 commit 8e9ce7d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
3 changes: 2 additions & 1 deletion contrib/standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM dgraph/dgraph:latest
ARG DGRAPH_VERSION=latest
FROM dgraph/dgraph:${DGRAPH_VERSION}
LABEL MAINTAINER="Dgraph Labs <[email protected]>"

# Ratel port
Expand Down
13 changes: 0 additions & 13 deletions contrib/standalone/Dockerfile.master

This file was deleted.

39 changes: 37 additions & 2 deletions contrib/standalone/Makefile
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions contrib/standalone/hooks/build
Original file line number Diff line number Diff line change
@@ -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} .

0 comments on commit 8e9ce7d

Please sign in to comment.