File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ name: Java CD with Gradle
1010on :
1111 push :
1212 branches : [ "main" ]
13+
1314jobs :
1415 deploy :
1516 runs-on : ubuntu-latest
1617 steps :
1718 - uses : actions/checkout@v3.3.0
18-
19+
1920 - name : execute remote ssh & deploy backend server
2021 uses : appleboy/ssh-action@master
2122 with :
@@ -24,16 +25,11 @@ jobs:
2425 key : ${{ secrets.REMOTE_SSH_KEY }}
2526 port : ${{ secrets.REMOTE_SSH_PORT }}
2627 script : |
27- whoami
28- sudo su
2928 cd /home/ec2-user/backend/
3029 git pull origin main
3130 chmod +x ./gradlew
3231 ./gradlew build
33-
34- pid=$(lsof -t -i:8080)
35- if [ -n "$pid" ]; then
36- kill -9 $pid
37- fi
38-
39- nohup java -jar build/libs/devpals-0.0.1-SNAPSHOT.jar > log.txt 2>&1 &
32+ docker stop devpals-container || true
33+ docker rm devpals-container || true
34+ docker build -t devpals-app .
35+ docker run -d -p 8080:8080 --name devpals-container devpals-app
Original file line number Diff line number Diff line change 1+ FROM openjdk:17-jdk-slim
2+ LABEL authors="nkr42"
3+ COPY build/libs/devpals-0.0.1-SNAPSHOT.jar app.jar
4+ ENTRYPOINT ["java" , "-jar" , "/app.jar" ]
You can’t perform that action at this time.
0 commit comments