Skip to content
Snippets Groups Projects
Commit f27c14a9 authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-205: Build and push images for several services

parent 617d1a04
No related branches found
No related tags found
1 merge request!183Docker image building & pushing with CI pipeline caching
...@@ -20,7 +20,7 @@ volumes: ...@@ -20,7 +20,7 @@ volumes:
services: services:
pogo: pogo:
image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-pogo:${TANGO_POGO_VERSION} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-pogo:${TANGO_POGO_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}pogo container_name: ${CONTAINER_NAME_PREFIX}pogo
networks: networks:
- control - control
......
...@@ -7,4 +7,4 @@ RUN apt-get update && apt-get install -y python3 python3-pip python3-yaml git && ...@@ -7,4 +7,4 @@ RUN apt-get update && apt-get install -y python3 python3-pip python3-yaml git &&
git clone --depth 1 --branch master https://git.astron.nl/lofar2.0/pypcc git clone --depth 1 --branch master https://git.astron.nl/lofar2.0/pypcc
WORKDIR /pypcc WORKDIR /pypcc
CMD ["python3","pypcc2.py","--simulator","--port","4843"] CMD ["python3", "pypcc2.py", "--simulator", "--port","4843"]
...@@ -13,7 +13,7 @@ version: '2' ...@@ -13,7 +13,7 @@ version: '2'
services: services:
rest: rest:
image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-rest:${TANGO_REST_VERSION} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-rest:${TANGO_REST_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}tango-rest container_name: ${CONTAINER_NAME_PREFIX}tango-rest
networks: networks:
- control - control
......
...@@ -15,7 +15,7 @@ volumes: ...@@ -15,7 +15,7 @@ volumes:
services: services:
tangodb: tangodb:
image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-db:${TANGO_DB_VERSION} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-db:${TANGO_DB_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}tangodb container_name: ${CONTAINER_NAME_PREFIX}tangodb
networks: networks:
- control - control
...@@ -37,7 +37,7 @@ services: ...@@ -37,7 +37,7 @@ services:
restart: unless-stopped restart: unless-stopped
databaseds: databaseds:
image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-cpp:${TANGO_CPP_VERSION} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-cpp:${TANGO_CPP_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}databaseds container_name: ${CONTAINER_NAME_PREFIX}databaseds
networks: networks:
- control - control
......
...@@ -11,7 +11,7 @@ version: '2' ...@@ -11,7 +11,7 @@ version: '2'
services: services:
tangotest: tangotest:
image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-java:${TANGO_JAVA_VERSION} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-java:${TANGO_JAVA_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}tangotest container_name: ${CONTAINER_NAME_PREFIX}tangotest
networks: networks:
- control - control
......
...@@ -15,6 +15,7 @@ fi ...@@ -15,6 +15,7 @@ fi
. "${LOFAR20_DIR}/docker-compose/.env" || exit 1 . "${LOFAR20_DIR}/docker-compose/.env" || exit 1
# Array of tuples separated by space inside double quotes # Array of tuples separated by space inside double quotes
# These images are downloaded from a remote registry and pushed locally
REMOTE_IMAGES=( REMOTE_IMAGES=(
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-java ${TANGO_JAVA_VERSION}" "tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-java ${TANGO_JAVA_VERSION}"
"tango-itango ${TANGO_ITANGO_VERSION}" "tango-pogo ${TANGO_POGO_VERSION}" "tango-itango ${TANGO_ITANGO_VERSION}" "tango-pogo ${TANGO_POGO_VERSION}"
...@@ -22,48 +23,42 @@ REMOTE_IMAGES=( ...@@ -22,48 +23,42 @@ REMOTE_IMAGES=(
"tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-rest ${TANGO_REST_VERSION}" "tango-dsconfig ${TANGO_DSCONFIG_VERSION}" "tango-rest ${TANGO_REST_VERSION}"
) )
for image in "${REMOTE_IMAGES[@]}"; do # If first argument of bash script not set run first stage
# Set, splits tuple into $1 and $2 if [ -z "${1+x}" ]; then
# shellcheck disable=SC2086 # Iterate over al the REMOTE_IMAGES and pull them from remote and push local
set -- $image for image in "${REMOTE_IMAGES[@]}"; do
remote_url="${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-${1}:${2}" # Set, splits tuple into $1 and $2
local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${1}:${2}" # shellcheck disable=SC2086
docker pull "${remote_url}" set -- $image
docker tag "${remote_url}" "${local_url}" remote_url="${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-${1}:${2}"
docker push "${local_url}" local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${1}:${2}"
done docker pull "${remote_url}"
docker tag "${remote_url}" "${local_url}"
docker push "${local_url}"
done
fi
# Tuple of images and queries to detect changes
# TODO(Corne): Have this list generated from the .yml files
LOCAL_IMAGES=(
"elk" "elk-configure-host" "grafana" "prometheus" "lofar-device-base"
"docker-compose_jupyter" "docker-compose_integration-test"
"docker-compose_itango" "docker-compose_tango-prometheus-exporter"
)
# docker pull "${SKA_REPO}-${image}:" # If first argument set run second stage, determine LOCAL_IMAGE to build and
# push from the argument
if [ ! -z "${1+x}" ]; then
## Compile a list of the SKA images cd "${LOFAR20_DIR}/docker-compose" || exit 1
#SKA_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E ${SKA_REPO} | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
## Compile a list of LOFAR2.0 images
#LOFAR_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
#echo "$SKA_IMAGES"
#echo "$LOFAR_IMAGES"
#function tag_and_push() for image in "${LOCAL_IMAGES[@]}"; do
#{ if [ "${1}" == "${image}" ]; then
# ( make build "${image}"
# docker tag "${1}" "${2}" local_url="${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/${image}:latest"
# docker push "${2}" docker tag "${image}" "${local_url}"
# ) & docker push "${local_url}"
#} fi
# done
## Rename the SKA images for the LOFAR2.0 repo
## and push them to the LOFAR2.0 repo
#for IMAGE in ${SKA_IMAGES}; do
# PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION}
# tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
#done
#
## Rename the LOFAR2.0 images for the LOFAR2.0 repo
## and push them to the LOFAR2.0 repo
#for IMAGE in ${LOFAR_IMAGES}; do
# PUSH_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION}
# tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
#done
# wait fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment