Skip to content

Commit 6f23a6d

Browse files
committed
Add CI workflow to build and push Docker images
1 parent eebf7a2 commit 6f23a6d

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: docker.io
10+
IMAGE_NAME_BACKEND: famouswealth/devops-backend
11+
IMAGE_NAME_FRONTEND: famouswealth/devops-frontend
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Log in to Docker Hub
21+
uses: docker/login-action@v2
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
26+
- name: Build and push Backend image
27+
uses: docker/build-push-action@v5
28+
with:
29+
context: ./backend
30+
push: true
31+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}:latest
32+
33+
- name: Build and push Frontend image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: ./frontend
37+
push: true
38+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND }}:latest

0 commit comments

Comments
 (0)