From c3599cc962fb7f4c4684f835c7a236370529d3dd Mon Sep 17 00:00:00 2001 From: Tobias Ludwig Maier Date: Tue, 1 Nov 2022 02:29:23 +0100 Subject: [PATCH] Change approach for tagging the docker image Past: docker version Now: docker compose version Reasoning: We need to do larger changes to the Dockerfile to support Docker Compose v2 --- DOCKER_AND_COMPOSE_VERSION_MATRIX | 1 - README.md | 6 +++--- hooks/build | 11 +++++++++-- hooks/push | 13 ++++++++++--- hooks/test | 13 ++++++++++--- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/DOCKER_AND_COMPOSE_VERSION_MATRIX b/DOCKER_AND_COMPOSE_VERSION_MATRIX index ed25e6e..e9c524c 100644 --- a/DOCKER_AND_COMPOSE_VERSION_MATRIX +++ b/DOCKER_AND_COMPOSE_VERSION_MATRIX @@ -1,3 +1,2 @@ latest -20 1.29.* 20.10 1.29.* diff --git a/README.md b/README.md index 938539b..09db9d4 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,10 @@ This is very useful for CI pipelines, which leverage "Docker in Docker". ## Docker versions supported -There are versions based on different docker versions, e.g. `latest`, `20.10`, `19.03` and `19`. +Note: In the past. this docker image (tags) focused on the docker version (e.g. `latest`, `20.10`, `19.03` and `19`). +But as the docker releases got less disruptive, the approach changes to use the docker compose version as tags. -docker-compose matches the latest version compatible with the respective docker release. -Eg, `20.10` includes docker-compose 1.27.4. The `latest` tag always includes the latest docker-compose build. +The Docker Compose versions supported here use the most recent docker version compatible with it. All available Docker Engine versions and the respective Docker Compose versions are defined in [`DOCKER_AND_COMPOSE_VERSION_MATRIX`](./DOCKER_AND_COMPOSE_VERSION_MATRIX). diff --git a/hooks/build b/hooks/build index 9b6f10f..e989008 100755 --- a/hooks/build +++ b/hooks/build @@ -1,10 +1,17 @@ #!/usr/bin/env sh -set -ex +set -e while read -r docker_version compose_version; do - image=${DOCKER_REPO}:${docker_version} + if [ -z "${compose_version}" ] + then + tag="latest" + else + tag="${compose_version%.*}" + fi + image=${DOCKER_REPO}:${tag} + echo "# Building image ${image}..." docker build \ diff --git a/hooks/push b/hooks/push index 3fba919..05829c9 100755 --- a/hooks/push +++ b/hooks/push @@ -1,10 +1,17 @@ #!/usr/bin/env sh -set -ex +set -e -while read -r docker_version _; +while read -r _ compose_version; do - image=${DOCKER_REPO}:${docker_version} + if [ -z "${compose_version}" ] + then + tag="latest" + else + tag="${compose_version%.*}" + fi + image=${DOCKER_REPO}:${tag} + echo "# Pushing image ${image}..." docker image push "${image}" diff --git a/hooks/test b/hooks/test index 1e7f047..bb5adcb 100755 --- a/hooks/test +++ b/hooks/test @@ -1,10 +1,17 @@ #!/usr/bin/env sh -set -ex +set -e -while read -r docker_version _; +while read -r docker_version compose_version; do - image=${DOCKER_REPO}:${docker_version} + if [ -z "${compose_version}" ] + then + tag="latest" + else + tag="${compose_version%.*}" + fi + image=${DOCKER_REPO}:${tag} + echo "# Testing image ${image}..." export IMAGE_NAME="${image}"