-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_docker_file.sh
More file actions
executable file
·35 lines (25 loc) · 1.09 KB
/
create_docker_file.sh
File metadata and controls
executable file
·35 lines (25 loc) · 1.09 KB
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
#!/bin/bash
# target_os=${target:-"debian"}
# cat _partial/Dockerfile.${target_os} _partial/Dockerfile_ > Dockerfile
# curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/Dreamacro/clash/git/matching-refs/tags | grep -o 'v[0-9\.]\+' | sort -u
# docker images | grep none | grep -o "[a-f0-9]\{6,\}" | xargs docker rmi
if [ -z $1 ]
then
echo "Usage: ./create_docker_file.sh [clash_version]"
exit 1
fi
OS_LIST="debian alpine"
for target_os in $OS_LIST
do
cat _partial/Dockerfile.${target_os} _partial/Dockerfile_ \
| sed "s/^ARG CLASH_VERSION$/ARG CLASH_VERSION=${1}/g" \
> Dockerfile.${target_os}
done
echo "New Dockerfile(s) created."
ln -s Dockerfile.alpine Dockerfile
git add .
git commit -m "Update to version: ${1}"
commit=$(git log -1 | head -n 1 | grep -o '[0-9a-f]\{40,\}')
# sed -n '/Supported tags and respective Dockerfile links/,/Other Reference/p' README.md
# git log -1 | head -n 1 | grep -o "[0-9a-f]\{40,\}"
# sed '/Supported tags and respective Dockerfile links/,/Other Reference/s/\[latest[^)]\+),\? \?//g' README.md | head -n 50