Skip to content

Commit 8820e09

Browse files
authored
Create cd.yml
1 parent 3cb011c commit 8820e09

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/cd.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CD workflow
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
deploy:
9+
name: Build & Push to Docker Hub
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v2
18+
19+
- name: Login to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Build & push backend
26+
run: |
27+
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/spring-react-backend:latest ./backend
28+
docker push ${{ secrets.DOCKERHUB_USERNAME }}/spring-react-backend:latest
29+
30+
- name: Build & push frontend
31+
run: |
32+
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/spring-react-frontend:latest ./frontend
33+
docker push ${{ secrets.DOCKERHUB_USERNAME }}/spring-react-frontend:latest

0 commit comments

Comments
 (0)