add: deploy.yml 도커 실행문 추가 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy To EC2 | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH(원격 접속)로 EC2에 접속하기 | |
uses: appleboy/[email protected] | |
env: | |
APPLICATION_PROPERTIES: ${{ secrets.APPLICATION_PROPERTIES }} | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
envs: APPLICATION_PROPERTIES | |
script_stop: true | |
script: | | |
cd /home/ubuntu/LostArk | |
rm -rf src/main/resources/application.properties | |
git pull origin dev | |
echo "$APPLICATION_PROPERTIES" > src/main/resources/application.properties | |
./gradlew clean build | |
sudo fuser -k -n tcp 8080 || true | |
# 도커로 빌드한 이미지를 실행 | |
docker compose -f compose-prod.yml up --build -d | |
# 백그라운드로 서버 실행 | |
# nohup java -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 & |