Skip to content

Commit

Permalink
chore: dev CD pipeline docker compose 사용하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
soyesenna committed Jan 7, 2025
1 parent 2aade09 commit a5245b8
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,7 @@ jobs:
script: |
docker pull ${{ secrets.DEV_DOCKER_USER_NAME }}/gachtaxi:latest
# Blue-Green Deployment 포트 및 컨테이너 이름 설정
BLUE_PORT=8080
GREEN_PORT=8081
BLUE_NAME="blue"
GREEN_NAME="green"
# 현재 실행 중인 컨테이너 확인
IS_BLUE_ON=$(sudo docker ps --filter "name=$BLUE_NAME" --filter "status=running" -q)
if [ -n "$IS_BLUE_ON" ]; then
echo "** ${GREEN_PORT} 포트에서 GREEN 컨테이너 실행"
sudo docker run --platform linux/arm64 --name $GREEN_NAME -d -p $GREEN_PORT:$GREEN_PORT \
--env-file ./gachtaxi-dev.env --network gachtaxi -e SPRING_PROFILES_ACTIVE=dev -e TZ=Asia/Seoul ${{ secrets.DEV_DOCKER_USER_NAME }}/gachtaxi
BEFORE_NAME=$BLUE_NAME
AFTER_NAME=$GREEN_NAME
BEFORE_PORT=$BLUE_PORT
AFTER_PORT=$GREEN_PORT
else
echo "** ${BLUE_PORT} 포트에서 BLUE 컨테이너 실행"
sudo docker run --platform linux/arm64 --name $BLUE_NAME -d -p $BLUE_PORT:$BLUE_PORT \
--env-file ./gachtaxi-dev.env --network gachtaxi -e SPRING_PROFILES_ACTIVE=dev -e TZ=Asia/Seoul ${{ secrets.DEV_DOCKER_USER_NAME }}/gachtaxi
BEFORE_NAME=$GREEN_NAME
AFTER_NAME=$BLUE_NAME
BEFORE_PORT=$GREEN_PORT
AFTER_PORT=$BLUE_PORT
fi
echo "** ${AFTER_NAME} 컨테이너 실행 완료 (포트: ${AFTER_PORT})"
# 이전 컨테이너 중지 및 삭제
echo "** 이전 컨테이너(${BEFORE_NAME}) 종료 및 삭제"
sudo docker stop $BEFORE_NAME || true
sudo docker rm $BEFORE_NAME || true
docker compose up -d --no-deps gachtaxi
# 사용하지 않는 이미지 정리
echo "** 사용하지 않는 Docker 이미지 정리"
Expand Down

0 comments on commit a5245b8

Please sign in to comment.