1
0
Эх сурвалжийг харах

Update "hello-world" docs to be multiarch-aware

Tianon Gravi 8 жил өмнө
parent
commit
7c45aad1e8
2 өөрчлөгдсөн 8 нэмэгдсэн , 5 устгасан
  1. 7 4
      hello-world/update.sh
  2. 1 1
      update.sh

+ 7 - 4
hello-world/update.sh

@@ -1,7 +1,10 @@
 #!/bin/bash
-set -eo pipefail
+set -Eeuo pipefail
+
+image="${1:-hello-world}"
 
 docker pull hello-world &> /dev/null
+docker pull "$image" &> /dev/null
 
 exec > "$(dirname "$(readlink -f "$BASH_SOURCE")")/content.md"
 
@@ -9,11 +12,11 @@ echo '# Example output'
 echo
 
 echo '```console'
-echo '$ docker run hello-world'
+echo '$ docker run' "$image"
 docker run --rm hello-world
 echo
-echo '$ docker images hello-world'
-docker images hello-world | awk -F'  +' 'NR == 1 || $2 == "latest" { print $1"\t"$2"\t"$3"\t"$5 }' | column -t -s$'\t'
+echo '$ docker images' "$image"
+docker images "$image" | awk -F'  +' 'NR == 1 || $2 == "latest" { print $1"\t"$2"\t"$3"\t"$5 }' | column -t -s$'\t'
 echo '```'
 
 echo

+ 1 - 1
update.sh

@@ -26,7 +26,7 @@ for image in "${images[@]}"; do
 	namespace="${namespace%/}"
 
 	if [ -x "$repo/update.sh" ]; then
-		( set -x; "$repo/update.sh" )
+		( set -x; "$repo/update.sh" "$image" )
 	fi
 
 	if [ -e "$repo/content.md" ]; then