Skip to content

Commit aa514fc

Browse files
committed
cd
1 parent 1a8f51c commit aa514fc

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/docker-image.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ on:
77
branches: [ "main" ]
88

99
jobs:
10-
runs-on: ubuntu-latest
11-
1210
build:
1311
needs: analyze
14-
12+
runs-on: ubuntu-latest
1513
steps:
1614
- name: Checkout repository
1715
uses: actions/checkout@v4
@@ -34,7 +32,7 @@ jobs:
3432
tags: manojkumar8008/javafile:1234
3533
analyze:
3634
name: Analyze
37-
35+
runs-on: ubuntu-latest
3836
permissions:
3937
security-events: write # Required for CodeQL to upload results
4038
actions: read
@@ -60,16 +58,19 @@ jobs:
6058
- name: Perform CodeQL Analysis
6159
uses: github/codeql-action/analyze@v3
6260
deploy:
63-
needs: ["build,analyze"]
61+
needs: build
62+
runs-on: ubuntu-latest
6463
steps:
6564
- name: Deploy Docker image on EC2
6665
uses: appleboy/ssh-action@v1.0.3
6766
with:
6867
host: ${{ vars.EC2_HOST }}
6968
username: ${{ vars.EC2_USER }}
7069
key: ${{ secrets.EC2_KEY }}
71-
       script: |
72-
docker pull manojkumar8008/javafile:1234
73-
docker run -d -p 80:8080 manojkumar8008/javafile:1234
70+
script: |
71+
sudo docker pull manojkumar8008/javafile:1234
72+
sudo docker stop hello-world || true
73+
sudo docker rm hello-world || true
74+
sudo docker run -d --name hello-world -p 80:8080 manojkumar8008/javafile:1234
7475
7576

0 commit comments

Comments
 (0)