From bcdc2d00200a5326d2b57364604ad2f62ad8efa6 Mon Sep 17 00:00:00 2001 From: DongkyunKim <134477764+dongkyun0713@users.noreply.github.com> Date: Thu, 18 Jul 2024 02:55:55 +0900 Subject: [PATCH] Fix(#14): deploy_production.yml --- .github/workflows/deploy_production.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy_production.yml b/.github/workflows/deploy_production.yml index b6139b2f..e0df3d90 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy_production.yml @@ -60,10 +60,10 @@ jobs: run: | if [ "${{ env.CURRENT_CONTAINER }}" == "${{ env.CONTAINER_NAME_BLUE }}" ]; then echo "NEW_CONTAINER=${{ env.CONTAINER_NAME_GREEN }}" >> $GITHUB_ENV - echo "NEW_PORT=8088" >> $GITHUB_ENV + echo "NEW_PORT='${{ secrets.BLUE_PORT }}'" >> $GITHUB_ENV else echo "NEW_CONTAINER=${{ env.CONTAINER_NAME_BLUE }}" >> $GITHUB_ENV - echo "NEW_PORT=8087" >> $GITHUB_ENV + echo "NEW_PORT='${{ secrets.GREEN_PORT }}'" >> $GITHUB_ENV fi - name: Deploy to EC2 @@ -78,13 +78,14 @@ jobs: CURRENT_PORT=${{ env.CURRENT_PORT }} NEW_PORT=${{ env.NEW_PORT }} - if [ $(sudo docker ps -q -f name="$NEW_CONTAINER") ]; then - sudo docker stop "$NEW_CONTAINER" - sudo docker rm "$NEW_CONTAINER" + if [ $(sudo docker ps -q -f name=$NEW_CONTAINER) ]; then + sudo docker stop $NEW_CONTAINER + sudo docker rm $NEW_CONTAINER fi sudo docker pull ${{ env.DOCKER_IMAGE_NAME }} - sudo docker run --name "$NEW_CONTAINER" -d -p "$NEW_PORT":8087 -e TZ=Asia/Seoul ${{ env.DOCKER_IMAGE_NAME }} + sudo docker run --name $NEW_CONTAINER -d -p $NEW_PORT:"${{ secrets.GREEN_PORT }}" -e TZ=Asia/Seoul ${{ env.DOCKER_IMAGE_NAME }} echo "CURRENT_CONTAINER='${NEW_CONTAINER}'" >> "$GITHUB_ENV" echo "CURRENT_PORT='${NEW_PORT}'" >> "$GITHUB_ENV" +