Skip to content

Commit 4fe48ba

Browse files
committed
Fixed docker script
1 parent be40089 commit 4fe48ba

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

scripts/push_docker_images.sh

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,44 @@
55
set -euo pipefail
66
trap "echo 'error: Script failed: see failed command above'" ERR
77

8+
# vars
9+
# DOCKER_FQDN='docker.thehypepipe.co.uk'
10+
DOCKER_SERVER="https://$DOCKER_FQDN"
11+
812
# Check if images already exist
9-
message="Pushing docker images"
10-
echo -e "\nSTARTED: $message..."
13+
main_message="Pushing docker image tasks"
14+
echo -e "\nSTARTED: $main_message..."
1115

1216
# List repositories
13-
repos=$(curl -s "$DOCKER_FQDN/v2/_catalog" | jq ".repositories")
17+
repos=$(curl -s "$DOCKER_SERVER/v2/_catalog" | jq ".repositories")
1418

1519
if [[ "$repos" == "[]" ]]; then
20+
message="Pulling base images..."
21+
echo -e "\nSTARTED: $message..."
1622
docker pull busybox
1723
docker pull nginxdemos/hello
24+
echo -e "\nFINISHED: $message."
1825

19-
docker image tag busybox "$DOCKER_FQDN/busybox"
20-
docker image tag nginxdemos/hello "$DOCKER_FQDN/hello"
21-
22-
docker image ls "$DOCKER_FQDN/busybox"
23-
docker image ls "$DOCKER_FQDN/hello"
26+
message="Tagging images..."
27+
docker image tag busybox "$DOCKER_SERVER/busybox"
28+
docker image tag nginxdemos/hello "$DOCKER_SERVER/hello"
29+
echo -e "\nFINISHED: $message."
2430

25-
docker push "$DOCKER_FQDN/busybox"
26-
docker push "$DOCKER_FQDN/hello"
31+
message="Listing images..."
32+
docker image ls "$DOCKER_SERVER/busybox"
33+
docker image ls "$DOCKER_SERVER/hello"
34+
echo -e "\nFINISHED: $message."
2735

36+
message="Pushing images..."
37+
docker push "$DOCKER_SERVER/busybox"
38+
docker push "$DOCKER_SERVER/hello"
2839
echo -e "\nFINISHED: $message."
40+
41+
echo -e "\nFINISHED: $main_message."
2942
else
30-
echo -e "\nSKIPPING: $message...they already exist in repo."
43+
echo -e "\nSKIPPING: $main_message...they already exist in repo."
3144

3245
# List tags
33-
curl -s "$DOCKER_FQDN/v2/busybox/tags/list"
34-
curl -s "$DOCKER_FQDN/v2/hello/tags/list"
46+
curl -s "$DOCKER_SERVER/v2/busybox/tags/list"
47+
curl -s "$DOCKER_SERVER/v2/hello/tags/list"
3548
fi

0 commit comments

Comments
 (0)