Skip to content
Snippets Groups Projects
Commit 814b861f authored by Stewart Williams's avatar Stewart Williams
Browse files

Extract docker registry details, making them configurable.

Add TBD docker registry username
parent dfeae15f
No related branches found
No related tags found
No related merge requests found
Showing
with 113 additions and 72 deletions
......@@ -7,20 +7,38 @@ are useful for TANGO control system development.
The following Docker images are built by this project:
Docker image | Description
-----------------------|------------
ska/tango-dependencies | A base image containing TANGO's preferred version of ZeroMQ plus the preferred, patched version of OmniORB.
ska/tango-db | A MariaDB image including TANGO database schema. Data is stored separately in a volume.
ska/tango-cpp | Core C++ TANGO libraries and applications.
ska/tango-java | As per ska/tango-cpp, plus Java applications and bindings
ska/tango-python | Extends ska/tango-cpp, adding PyTango Python bindings and itango for interactive TANGO sessions.
ska/tango-pogo | Image for running Pogo and displaying Pogo help. Pogo output can be persisted to a docker volume or to the host machine.
ska/tango-starter | Example image that demonstrates how to package the Starter device in an image.
To build the images, from the root of this repository execute:
-------------------|------------
tango-dependencies | A base image containing TANGO's preferred version of ZeroMQ plus the preferred, patched version of OmniORB.
tango-db | A MariaDB image including TANGO database schema. Data is stored separately in a volume.
tango-cpp | Core C++ TANGO libraries and applications.
tango-java | As per ska/tango-cpp, plus Java applications and bindings
tango-python | Extends ska/tango-cpp, adding PyTango Python bindings and itango for interactive TANGO sessions.
tango-pogo | Image for running Pogo and displaying Pogo help. Pogo output can be persisted to a docker volume or to the host machine.
tango-starter | Example image that demonstrates how to package the Starter device in an image.
To build and register the images locally, from the root of this repository
execute:
cd docker
# build and register TBC/tango-cpp, TBC/tango-jive, etc. locally
make build
Optionally, you can register images to an alternative Docker registry account
by supplying the ``DOCKER_REGISTRY_HOST`` and ``DOCKER_REGISTRY_USER``
Makefile variables, e.g.,
# build and register images as foo/tango-cpp, foo/tango-jive, etc.
make DOCKER_REGISTRY_USER=foo build
Push the built images to a Docker registry using ``make push`` target. The
URL of the registry can be specified by providing the ``DOCKER_REGISTRY_HOST``
Makefile argument.
# push the images to the Docker registry, making them publicly
# available as foo/tango-cpp, foo/tango-jive, etc.
make DOCKER_REGISTRY_USER=foo DOCKER_REGISTRY_HOST=docker.io push
## Launching TANGO applications and services
The docker-compose directory contains a set of files that can be used to run a
TANGO system in Docker containers. The following services are defined:
......@@ -37,6 +55,18 @@ astor | Astor application
starter-example | Example service running TANGO Starter device
itango | interactive itango session
To pull pre-built images from the Docker hub, execute:
cd docker-compose
# download official SKA images
make pull
Optional: the images can be pulled from an alternative account by supplying
the DOCKER_REGISTRY_USER Makefile variable, e.g.,
cd docker-compose
# download foo/tango-cpp, foo/tango-jive, etc.
make DOCKER_REGISTRY_USER=foo pull
To start and stop a minimal TANGO system (database and databaseds server),
execute:
......
DOCKER_REGISTRY_USER=tbd
......@@ -22,9 +22,12 @@ endif
MY_IP := $(shell ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | head -n1)
DISPLAY = $(MY_IP):0
.PHONY: up down minimal start stop status help
.PHONY: up down minimal start stop status clean pull help
.DEFAULT_GOAL := help
pull: ## pull the images from the Docker hub
docker-compose $(COMPOSE_FILE_ARGS) pull
up: minimal ## start the base TANGO system and prepare all services
DISPLAY=$(DISPLAY) docker-compose $(COMPOSE_FILE_ARGS) up --no-start
......
......@@ -15,7 +15,7 @@ services:
astor:
build:
context: ../docker/tango/tango-java
image: ska/tango-java:latest
image: ${DOCKER_REGISTRY_USER}/tango-java:latest
container_name: astor
depends_on:
- databaseds
......@@ -36,7 +36,7 @@ services:
starter-example:
build:
context: ../docker/tango/tango-starter
image: ska/tango-starter:latest
image: ${DOCKER_REGISTRY_USER}/tango-starter:latest
container_name: starter-example
# set the hostname, otherwise duplicate device registrations result every
# time the hostname changes as the container is restarted.
......
......@@ -16,8 +16,7 @@ services:
itango:
build:
context: ../docker/tango/tango-python
dockerfile: Dockerfile.python
image: ska/tango-python:latest
image: ${DOCKER_REGISTRY_USER}/tango-python:latest
container_name: itango
depends_on:
- databaseds
......
......@@ -14,7 +14,7 @@ services:
jive:
build:
context: ../docker/tango/tango-java
image: ska/tango-java:latest
image: ${DOCKER_REGISTRY_USER}/tango-java:latest
container_name: jive
depends_on:
- databaseds
......
......@@ -14,7 +14,7 @@ services:
logviewer:
build:
context: ../docker/tango/tango-java
image: ska/tango-java:latest
image: ${DOCKER_REGISTRY_USER}/tango-java:latest
container_name: logviewer
depends_on:
- databaseds
......
......@@ -22,7 +22,7 @@ services:
pogo:
build:
context: ../docker/tango/tango-pogo
image: ska/tango-pogo:latest
image: ${DOCKER_REGISTRY_USER}/tango-pogo:latest
container_name: pogo
volumes:
- pogo:/home/tango
......
......@@ -16,7 +16,7 @@ services:
tangodb:
build:
context: ../docker/tango/tango-db
image: ska/tango-db:latest
image: ${DOCKER_REGISTRY_USER}/tango-db:latest
container_name: tangodb
environment:
- MYSQL_ROOT_PASSWORD=secret
......@@ -29,7 +29,7 @@ services:
databaseds:
build:
context: ../docker/tango/tango-cpp
image: ska/tango-cpp:latest
image: ${DOCKER_REGISTRY_USER}/tango-cpp:latest
container_name: databaseds
hostname: databaseds
depends_on:
......
......@@ -13,7 +13,7 @@ services:
tangotest:
build:
context: ../docker/tango/tango-java
image: ska/tango-java:latest
image: ${DOCKER_REGISTRY_USER}/tango-java:latest
container_name: tangotest
depends_on:
- databaseds
......
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/Makefile.mk
REGISTRY_HOST=
USERNAME=ska
#NAME=
DOCKER_REGISTRY_HOST=
DOCKER_REGISTRY_USER=tbd
......@@ -13,13 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
REGISTRY_HOST=docker.io
USERNAME=$(USER)
DOCKER_REGISTRY_HOST=docker.io
DOCKER_REGISTRY_USER=$(USER)
NAME=$(shell basename $(CURDIR))
RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support
#IMAGE=$(REGISTRY_HOST)/$(USERNAME)/$(NAME)
IMAGE=$(USERNAME)/$(NAME)
IMAGE=$(DOCKER_REGISTRY_USER)/$(NAME)
VERSION=$(shell . $(RELEASE_SUPPORT) ; getVersion)
TAG=$(shell . $(RELEASE_SUPPORT); getTag)
......@@ -48,7 +47,7 @@ post-push:
docker-build: .release
docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH)
docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH) --build-arg DOCKER_REGISTRY_USER=$(DOCKER_REGISTRY_USER)
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \
if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \
......@@ -80,14 +79,14 @@ snapshot: build push
showver: .release
@. $(RELEASE_SUPPORT); getVersion
tag-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel)
tag-patch-release: .release tag
bump-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel)
bump-patch-release: .release tag
tag-minor-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel)
tag-minor-release: .release tag
bump-minor-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel)
bump-minor-release: .release tag
tag-major-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
tag-major-release: .release tag
bump-major-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
bump-major-release: .release tag
patch-release: tag-patch-release release
@echo $(VERSION)
......@@ -101,12 +100,12 @@ major-release: tag-major-release release
tag: TAG=$(shell . $(RELEASE_SUPPORT); getTag $(VERSION))
tag: check-status
@. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ;
# @. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; setRelease $(VERSION)
git add .
git commit -m "bumped to version $(VERSION)" ;
git tag $(TAG) ;
@ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
# git add .
# git commit -m "bumped to version $(VERSION)" ;
# git tag $(TAG) ;
# @ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
check-status:
@. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2 && exit 1) ;
......
TRGTS = tango-dependencies tango-db tango-cpp tango-java tango-python tango-starter tango-pogo
DIRS = tango-dependencies tango-db tango-cpp tango-java tango-python tango-starter tango-pogo
BUILDDIRS = $(DIRS:%=build-%)
CHECKSTATUSDIRS = $(DIRS:%=checkstatus-%)
SHOWVERDIRS = $(DIRS:%=showver-%)
PUSHDIRS = $(DIRS:%=push-%)
.PHONY: build tango-dependencies tango-db tango-cpp tango-java tango-python tango-starter tango-starter tango-pogo
.DEFAULT_GOAL := help
build: $(TRGTS) ## build all images
build: $(DIRS) ## build all images
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%) build
tango-dependencies: ## build base dependency image
$(MAKE) -C tango-dependencies
check-status: $(CHECKSTATUSDIRS) ## check whether subdirectories have uncommitted changes
$(CHECKSTATUSDIRS):
$(MAKE) -C $(@:checkstatus-%=%) check-status
tango-db: ## build ska/tango-db image
$(MAKE) -C tango-db
showver: $(SHOWVERDIRS) ## show image versions
$(SHOWVERDIRS):
$(MAKE) -C $(@:showver-%=%) showver
tango-cpp: tango-dependencies ## build ska/tango-cpp image
$(MAKE) -C tango-cpp
tango-java: tango-dependencies ## build ska/tango-java image
$(MAKE) -C tango-java
tango-python: tango-dependencies ## build ska/tango-python image
$(MAKE) -C tango-python
tango-starter: tango-cpp ## build ska/tango-starter image
$(MAKE) -C tango-starter
tango-pogo: tango-java ## build ska/tango-pogo image
$(MAKE) -C tango-pogo
push: $(PUSHDIRS) ## push images to Docker hub
$(PUSHDIRS):
$(MAKE) -C $(@:push-%=%) push
help: ## show this help.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(CHECKSTATUSDIRS)
.PHONY: subdirs $(PUSHDIRS)
.PHONY: subdirs $(SHOWVERDIRS)
.PHONY: build check-status showver push help
FROM ska/tango-dependencies:latest
ARG DOCKER_REGISTRY_USER
FROM ${DOCKER_REGISTRY_USER}/tango-dependencies:latest
RUN TANGO_VERSION=9.2.5a \
&& TANGO_DOWNLOAD_URL=https://netcologne.dl.sourceforge.net/project/tango-cs/tango-$TANGO_VERSION.tar.gz \
......
FROM ska/tango-dependencies:latest
ARG DOCKER_REGISTRY_USER
FROM ${DOCKER_REGISTRY_USER}/tango-dependencies:latest
RUN runtimeDeps='default-jre' \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
......
FROM ska/tango-java:latest
ARG DOCKER_REGISTRY_USER
FROM ${DOCKER_REGISTRY_USER}/tango-java:latest
USER root
......
FROM ska/tango-cpp:latest
ARG DOCKER_REGISTRY_USER
FROM ${DOCKER_REGISTRY_USER}/tango-cpp:latest
USER root
......
FROM ska/tango-cpp:latest
ARG DOCKER_REGISTRY_USER
FROM ${DOCKER_REGISTRY_USER}/tango-cpp:latest
USER root
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment