Skip to content

Commit

Permalink
Fix(#14): deploy_production.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkyun0713 authored Jul 17, 2024
1 parent ee4c9b6 commit bcdc2d0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit bcdc2d0

Please sign in to comment.