From 2069eddf98a0ad8a488506170a5c6246083fb302 Mon Sep 17 00:00:00 2001
From: Ainar Garipov <a.garipov@adguard.com>
Date: Wed, 28 Jun 2023 18:12:45 +0300
Subject: [PATCH] Pull request 1896: fix-docker

Squashed commit of the following:

commit e64194bd053085b6bdcef6dcda40e7b52234a2ec
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jun 28 18:02:22 2023 +0300

    scripts: fix docker tags
---
 scripts/make/build-docker.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/scripts/make/build-docker.sh b/scripts/make/build-docker.sh
index ab754edc3f8..f198464213a 100644
--- a/scripts/make/build-docker.sh
+++ b/scripts/make/build-docker.sh
@@ -62,16 +62,21 @@ readonly docker_output
 case "$channel"
 in
 ('release')
-	docker_tags="--tag=${docker_image_name}:${version},${docker_image_name}:latest"
+	docker_version_tag="${docker_image_name}:${version}"
+	docker_channel_tag="${docker_image_name}:latest"
 	;;
 ('beta')
-	docker_tags="--tag=${docker_image_name}:${version},${docker_image_name}:beta"
+	docker_version_tag="${docker_image_name}:${version}"
+	docker_channel_tag="${docker_image_name}:beta"
 	;;
 ('edge')
-	docker_tags="--tag=${docker_image_name}:edge"
+	# Don't set the version tag when pushing to the edge channel.
+	docker_version_tag="${docker_image_name}:edge"
+	docker_channel_tag="${docker_image_name}"
 	;;
 ('development')
-	docker_tags="--tag=${docker_image_name}"
+	docker_version_tag="${docker_image_name}"
+	docker_channel_tag="${docker_image_name}"
 	;;
 (*)
 	echo "invalid channel '$channel', supported values are\
@@ -79,7 +84,7 @@ in
 	exit 1
 	;;
 esac
-readonly docker_tags
+readonly docker_version_tag docker_channel_tag
 
 # Copy the binaries into a new directory under new names, so that it's easier to
 # COPY them later.  DO NOT remove the trailing underscores.  See file
@@ -122,6 +127,7 @@ $sudo_cmd docker\
 	--build-arg VERSION="$version"\
 	--output "$docker_output"\
 	--platform "$docker_platforms"\
-	"$docker_tags"\
+	--tag="$docker_version_tag"\
+	--tag="$docker_channel_tag"\
 	-f ./docker/Dockerfile\
 	.