Skip to content

Commit

Permalink
refactor: cd yml ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsongmok committed Oct 23, 2024
1 parent 8fb5480 commit 757bf85
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }} # ์ƒˆ ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰
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

0 comments on commit 757bf85

Please sign in to comment.