Skip to content

Commit

Permalink
Update gradle.yml
Browse files Browse the repository at this point in the history
Update gradle.yml
  • Loading branch information
InJun2 authored Jun 30, 2024
1 parent a035563 commit 3e540a4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,23 @@ jobs:
docker build -t ${{ secrets.DOCKER_USERNAME }}/url-shortener .
docker push ${{ secrets.DOCKER_USERNAME }}/url-shortener
- name: Deploy
- name: Deploy and Start Spring Boot Application
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_PROD }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
envs: GITHUB_SHA
script: |
sudo docker ps
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/url-shortener
sudo docker stop server || true
sudo docker run -d -p 8080:8080 --name server ${{ secrets.DOCKER_USERNAME }}/url-shortener
docker image prune -f
- name: Deploy Spring Boot Application
run: |
nohup java -jar /path/to/your/application.jar > stdout.log 2> stderr.log &
- name: Retrieve logs
run: |
ssh ec2-user@${{ secrets.HOST_PROD }} 'echo "STDOUT:" && sudo tail -n 100 /var/log/docker.log && echo "STDERR:" && sudo tail -n 100 /var/log/docker.err'

0 comments on commit 3e540a4

Please sign in to comment.