From 757bf8581285ea18972f4821ab2fd9990efcaddc Mon Sep 17 00:00:00 2001 From: KimSongMok Date: Wed, 23 Oct 2024 22:31:31 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20cd=20yml=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0652c1d6..690bc8b9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,6 +17,17 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + - name: Create env.properties + run: | + echo "MYSQL_DATABASE=${{ secrets.MYSQL_PROD_DATABASE }}" >> env.properties + echo "MYSQL_USER=${{ secrets.MYSQL_PROD_USER }}" >> env.properties + echo "MYSQL_PASSWORD=${{ secrets.MYSQL_PROD_PASSWORD }}" >> env.properties + echo "MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}" >> env.properties + echo "CLIENT_ID=${{ secrets.CLIENT_ID }}" >> env.properties + echo "CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}" >> env.properties + echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> env.properties + echo "REDIRECT_URL=${{ secrets.REDIRECT_URL }}" >> env.properties + cp env.properties ./src/main/resources - name: Set up Java 21 uses: actions/setup-java@v3 @@ -47,7 +58,17 @@ jobs: username: ubuntu key: ${{ secrets.EC2_SSH_KEY }} script: | - sudo docker pull kimsongmok/splanet:${{ env.IMAGE_TAG }} # 새 이미지 풀링 - sudo docker stop splanet || true # 기존 컨테이너 중지 - sudo docker rm splanet || true # 기존 컨테이너 제거 - sudo docker run -d --name splanet -p 80:8080 kimsongmok/splanet:${{ env.IMAGE_TAG }} # 새 컨테이너 실행 \ No newline at end of file + sudo docker pull kimsongmok/splanet:${{ env.IMAGE_TAG }} + sudo docker stop splanet || true + sudo docker rm splanet || true + sudo docker run -d --name splanet \ + -e MYSQL_PROD_URL=${{ secrets.MYSQL_PROD_URL }} \ + -e MYSQL_USER=${{ secrets.MYSQL_PROD_USER }} \ + -e MYSQL_PASSWORD=${{ secrets.MYSQL_PROD_PASSWORD }} \ + -e MYSQL_DATABASE=${{ secrets.MYSQL_DATABASE }} \ + -e CLIENT_ID=${{ secrets.CLIENT_ID }} \ + -e CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} \ + -e JWT_SECRET=${{ secrets.JWT_SECRET }} \ + -e REDIRECT_URL=${{ secrets.REDIRECT_URL }} \ + -p 80:8080 --restart unless-stopped kimsongmok/splanet:${{ env.IMAGE_TAG }}\ + -v ./src/main/resources/env.properties \ No newline at end of file