From 97b4eaec386df26ac393f1fe19ed179ae0404495 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 6 Aug 2026 11:44:34 +0700 Subject: [PATCH] update to git --- docker-push.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 docker-push.sh diff --git a/docker-push.sh b/docker-push.sh new file mode 100755 index 0000000..10e0825 --- /dev/null +++ b/docker-push.sh @@ -0,0 +1,29 @@ +!/bin/bash + +#get image name +remote_url=$(git remote get-url origin) +image=$(echo $remote_url | sed 's|https://||g; s|.git||g') + +#get branch name +branch_name=$(git rev-parse --abbrev-ref HEAD) +clean_branch_name=${branch_name##*/} + +#get timestamp for the tag +timestamp=$(date +%Y%m%d%H%M%S) + +app_version=$clean_branch_name-$timestamp +tag=$image:$timestamp-$clean_branch_name +latest=$image:latest-$clean_branch_name + +#build image +docker build --build-arg APP_VERSION=$app_version -t $tag . +docker tag $tag $latest + +#push to dockerhub +# docker login git.rssa.top -u stim -p 4fde63b07906e7bfa6b3493d76d153a3981039b9 +docker login git.rssa.top -u ryan -p c55464c5b65716a35f2b106ea2ebd13416167c59 +docker push $tag +docker push $latest + +#remove dangling images +docker system prune -f