update.sh 785 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -Eeuo pipefail
  3. image="${1:-hello-world}"
  4. docker pull hello-world &> /dev/null
  5. docker pull "$image" &> /dev/null
  6. exec > "$(dirname "$(readlink -f "$BASH_SOURCE")")/content.md"
  7. echo '# Example output'
  8. echo
  9. echo '```console'
  10. echo '$ docker run' "$image"
  11. docker run --rm hello-world
  12. echo
  13. echo '$ docker images' "$image"
  14. docker images "$image" | awk -F' +' 'NR == 1 || $2 == "latest" { print $1"\t"$2"\t"$3"\t"$5 }' | column -t -s$'\t'
  15. echo '```'
  16. echo
  17. echo '%%LOGO%%'
  18. echo
  19. cat <<'EOF'
  20. # How is this image created?
  21. This image is a prime example of using the [`scratch`](https://hub.docker.com/_/scratch/) image effectively. See [`hello.c`](%%GITHUB-REPO%%/blob/master/hello.c) in %%GITHUB-REPO%% for the source code of the `hello` binary included in this image.
  22. EOF