File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Frontend AWS EC2 CD
2
+
3
+ on :
4
+ workflow_run :
5
+ workflows : ["Frontend Docker Image CI"]
6
+ types :
7
+ - completed
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : [self-hosted, frontend]
12
+
13
+ steps :
14
+ - name : Login to Dockerhub
15
+ uses : docker/login-action@v3
16
+ with :
17
+ username : ${{ secrets.DOCKER_USERNAME }}
18
+ password : ${{ secrets.DOCKER_PASSWORD }}
19
+ - name : Pull the Docker image
20
+ run : sudo docker pull nathan7934/whosaidit-frontend:latest
21
+ - name : Delete old Docker container
22
+ run : sudo docker rm -f whosaidit-frontend-container || true
23
+ - name : Run new Docker container
24
+ run : sudo docker run -d -p 80:3000 --name whosaidit-frontend-container nathan7934/whosaidit-frontend
Original file line number Diff line number Diff line change
1
+ name : Frontend Docker Image CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ "master" ]
6
+ pull_request :
7
+ branches : [ "master" ]
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - uses : actions/checkout@v3
15
+
16
+ - name : Set up Docker Buildx
17
+ uses : docker/setup-buildx-action@v3
18
+
19
+ - name : Login to Dockerhub
20
+ uses : docker/login-action@v3
21
+ with :
22
+ username : ${{ secrets.DOCKER_USERNAME }}
23
+ password : ${{ secrets.DOCKER_PASSWORD }}
24
+
25
+ - name : Build and push
26
+ uses : docker/build-push-action@v5
27
+ with :
28
+ context : " {{defaultContext}}:frontend"
29
+ file : ./Dockerfile
30
+ push : true
31
+ tags : nathan7934/whosaidit-frontend:latest
You can’t perform that action at this time.
0 commit comments