-
Notifications
You must be signed in to change notification settings - Fork 5
/
generate-readme.sh
executable file
·57 lines (46 loc) · 1.38 KB
/
generate-readme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -eux
owner=fukamachi
image="$@"
if [ "$image" == "" ]; then
echo "No image name is given."
exit -1
fi
if [ ! -d "$image" ]; then
echo "Invalid image name: ${image}"
exit -1
fi
cd $image
image=$(basename `pwd`)
versions=( `cat versions | awk -F, '{ print $1 }' | sort -Vr` )
echo "# Docker images for $image"
echo
echo "[![Docker Pulls](https://img.shields.io/docker/pulls/$owner/$image.svg)](https://hub.docker.com/r/$owner/$image/)"
echo "[![Docker Stars](https://img.shields.io/docker/stars/$owner/$image.svg)](https://hub.docker.com/r/$owner/$image/)"
echo
echo "## Usage"
echo
echo "\`\`\`"
echo "$ docker pull $owner/$image"
echo "$ docker run -it --rm $owner/$image"
echo "$ docker pull $owner/$image:${versions[1]}"
echo "$ docker run -it --rm $owner/$image:${versions[1]}"
echo "\`\`\`"
echo
echo "## Supported tags"
echo
echo "- \`${versions[0]}\`, \`${versions[0]}-debian\`, \`latest\`, \`latest-debian\`"
echo "- \`${versions[0]}-ubuntu\`, \`latest-ubuntu\`"
echo "- \`${versions[0]}-alpine\`, \`latest-alpine\`"
unset versions[0]
for version in "${versions[@]}"; do
echo "- \`${version}\`, \`${version}-debian\`"
echo "- \`${version}-alpine\`"
echo "- \`${version}-ubuntu\`"
done
echo
echo "## Building by your own"
echo
echo "\`\`\`"
echo "$ docker build -t $image:${versions[1]} --build-arg VERSION=${versions[1]} $image/debian/"
echo "\`\`\`"