forked from final-T/GlowGrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerTagAndPush.sh
More file actions
27 lines (20 loc) ยท 1.02 KB
/
dockerTagAndPush.sh
File metadata and controls
27 lines (20 loc) ยท 1.02 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
# ๋ชจ๋ ์๋น์ค ๋์ปค ์ด๋ฏธ์ง๋ฅผ ๋น๋ํฉ๋๋ค.
services=(
"glowgrow-eureka" "glowgrow-gateway" "glowgrow-auth" "glowgrow-user"
"glowgrow-payment" "glowgrow-notification" "glowgrow-post" "glowgrow-promotion" "glowgrow-reservation" "glowgrow-multimedia"
)
# ๋์ปค ์ด๋ฏธ์ง์ commit hash๋ฅผ ๊ธฐ๋ฐ์ผ๋กํ ์ด๋ฏธ์ง ํ๊ทธ๋ฅผ ์ค์ ํฉ๋๋ค.
commit_hash=$(git rev-parse --short HEAD)
for service in "${services[@]}"
do
imageName="$DOCKER_HUB_NAMESPACE/$service"
# ๋์ปค ์ด๋ฏธ์ง ๋น๋ (ํด๋น service ๋๋ ํ ๋ฆฌ์ Dockerfile์ด ์์ด์ผ ํฉ๋๋ค.)
docker build -t "$imageName:latest" "./$service"
# ์ด๋ฏธ์ง๋ฅผ ๊ตฌ๋ถํ๊ธฐ ์ํด์ latest ์ด์ธ์ ํ๊ทธ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
docker tag "$imageName:latest" "$imageName:$commit_hash"
# Docker Hub์ push
docker push "$imageName:latest"
docker push "$imageName:$commit_hash"
echo "$service ์ด๋ฏธ์ง๊ฐ ๋น๋๋์ด Docker hub์ ํธ์ฌ๋์์ต๋๋ค."
done
echo "๋ชจ๋ ์๋น์ค์ ์ด๋ฏธ์ง ๋น๋ ๋ฐ ํธ์ฌ๊ฐ ์๋ฃ๋์์ต๋๋ค."