Skip to content

Commit 42a3c7a

Browse files
committed
Merge branch 'master' of https://github.com/Nathan7934/WhoSaidIt
2 parents 1935730 + 8e77bc7 commit 42a3c7a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/frontend-cd.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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

.github/workflows/frontend-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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

0 commit comments

Comments
 (0)