--- /dev/null
+TOPDIR=$(shell readlink -f .|sed -e 's/\/docker\/.*//')
+MKINCLUDE=$(TOPDIR)/docker/mk
+MKBUILD=$(TOPDIR)/docker/build
+
+all: build
+
+TAG ?= latest
+
+REPOSITORY_BASE ?= http://osm-download.etsi.org/repository/osm/debian
+RELEASE ?= ReleaseFOUR-daily
+REPOSITORY_KEY ?= OSM%20ETSI%20Release%20Key.gpg
+REPOSITORY ?= testing
+NO_CACHE ?= --no-cache
+
+LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]')
+
+CMD_DOCKER_ARGS ?= -q
+DOCKER_ARGS = $(CMD_DOCKER_ARGS)
+
+DEPS := MON IM LCM RO common osmclient devops NBI
+
+DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS))
+
+Q=@
+
+$(MKBUILD):
+ $Qmkdir -p $(MKBUILD)
+
+$(MKBUILD)/.dep_%:
+ $Q$(MKINCLUDE)/get_version.sh -m $* > $@
+
+build: $(MKBUILD) $(DEPS_TARGETS)
+ $Qdocker build -t osm/$(LOWER_MDG):$(TAG) \
+ --build-arg RELEASE=$(RELEASE) \
+ --build-arg REPOSITORY=$(REPOSITORY) \
+ --build-arg REPOSITORY_KEY=$(REPOSITORY_KEY) \
+ --build-arg REPOSITORY_BASE=$(REPOSITORY_BASE) \
+ --build-arg MON_VERSION==$(shell cat $(MKBUILD)/.dep_MON) \
+ --build-arg IM_VERSION==$(shell cat $(MKBUILD)/.dep_IM) \
+ --build-arg RO_VERSION==$(shell cat $(MKBUILD)/.dep_RO) \
+ --build-arg LCM_VERSION==$(shell cat $(MKBUILD)/.dep_LCM) \
+ --build-arg COMMON_VERSION==$(shell cat $(MKBUILD)/.dep_common) \
+ --build-arg OSMCLIENT_VERSION==$(shell cat $(MKBUILD)/.dep_osmclient) \
+ --build-arg NBI_VERSION==$(shell cat $(MKBUILD)/.dep_NBI) \
+ $(DOCKER_ARGS) .
+
+clean:
+ rm -f $(MKBUILD)/.dep*
+
+tag:
+ docker tag osm/$(LOWER_MDG) osm/$(LOWER_MDG):$(TAG)