Skip to content

Commit fdc484b

Browse files
authored
build(standalone): Add DGRAPH_VERSION to build different Dgraph versions for standalone image. (#6082) (#6238)
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).
1 parent 4bda0b3 commit fdc484b

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

contrib/standalone/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM dgraph/dgraph:latest
1+
ARG DGRAPH_VERSION=latest
2+
FROM dgraph/dgraph:${DGRAPH_VERSION}
23
LABEL MAINTAINER="Dgraph Labs <[email protected]>"
34

45
# Ratel port

contrib/standalone/Dockerfile.master

-13
This file was deleted.

contrib/standalone/Makefile

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1-
.PHONY: build
1+
# Build dgraph/standalone image
2+
# Usage:
3+
#
4+
# For latest tag:
5+
# Build, based on dgraph/dgraph:latest:
6+
# make
7+
# Push:
8+
# make push
9+
#
10+
# For $TAG tag, set DGRAPH_VERSION:
11+
# Build, based on dgraph/dgraph:latest:
12+
# make DGRAPH_VERSION=$TAG
13+
# Push:
14+
# make DGRAPH_VERSION=$TAG push
15+
#
16+
# Examples
17+
# Build and push latest:
18+
# make
19+
# make push
20+
#
21+
# Build and push master:
22+
# make DGRAPH_VERSION=master
23+
# make DGRAPH_VERSION=master push
24+
#
25+
.PHONY: all build push version
26+
27+
export DGRAPH_VERSION ?= latest
28+
29+
all: build version
30+
231
build:
3-
docker build -t dgraph/standalone:latest .
32+
./hooks/build
33+
34+
push:
35+
docker push dgraph/standalone:$(DGRAPH_VERSION)
36+
37+
version:
38+
docker run dgraph/standalone:$(DGRAPH_VERSION) dgraph version

contrib/standalone/hooks/build

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
# Used for Makefile or Docker Hub builds
3+
docker build -t dgraph/standalone:${DGRAPH_VERSION} --build-arg DGRAPH_VERSION=${DGRAPH_VERSION} .

0 commit comments

Comments
 (0)