Skip to content

Commit 6f29244

Browse files
committed
push workflow
1 parent 37496cb commit 6f29244

5 files changed

Lines changed: 85 additions & 1 deletion

File tree

.github/workflows/Build-Push.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Push Docker Images to Docker Hub
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
push_to_docker_hub:
10+
name: Build & Push All Services
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Login to Docker Hub
18+
uses: docker/login-action@v3
19+
with:
20+
username: ${{ secrets.DOCKER_HUB_USER_NAME }}
21+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
22+
23+
- name: Set variables
24+
run: |
25+
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
26+
echo "DOCKER_USER=${{ secrets.DOCKER_HUB_USER_NAME }}" >> $GITHUB_ENV
27+
28+
# Build & Push API Gateway
29+
- name: Build & Push API Gateway
30+
run: |
31+
docker build ./backend/apigateway \
32+
-t $DOCKER_USER/devops-certificate-generator-apigateway:$IMAGE_TAG
33+
docker push $DOCKER_USER/devops-certificate-generator-apigateway:$IMAGE_TAG
34+
35+
# Build & Push PDF Generator
36+
- name: Build & Push PDF Generator
37+
run: |
38+
docker build ./backend/pdf-generator \
39+
-t $DOCKER_USER/devops-certificate-generator-pdf-generator:$IMAGE_TAG
40+
docker push $DOCKER_USER/devops-certificate-generator-pdf-generator:$IMAGE_TAG
41+
42+
# Build & Push Frontend
43+
- name: Build & Push Frontend
44+
run: |
45+
docker build ./frontend \
46+
-t $DOCKER_USER/devops-certificate-generator-frontend:$IMAGE_TAG
47+
docker push $DOCKER_USER/devops-certificate-generator-frontend:$IMAGE_TAG
48+
49+
- name: Logout from Docker Hub
50+
run: docker logout
51+
52+
- name: End
53+
run: echo "All Docker images pushed to Docker Hub successfully"

K8s/api-gateway-deployment.yaml

Whitespace-only changes.

K8s/frontend-deployment.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: frontend
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: frontend
10+
template:
11+
metadata:
12+
labels:
13+
app: frontend
14+
spec:
15+
containers:
16+
- name: frontend
17+
image: <your-dockerhub-username>/frontend:latest
18+
ports:
19+
- containerPort: 80
20+
---
21+
apiVersion: v1
22+
kind: Service
23+
metadata:
24+
name: frontend
25+
spec:
26+
selector:
27+
app: frontend
28+
ports:
29+
- port: 80
30+
targetPort: 80
31+
type: NodePort

K8s/frontend-ingress.yaml

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
accessModes:
99
- ReadWriteOnce
1010
hostPath:
11-
path: \\wsl.localhost\Ubuntu-22.04\home\harsh\projects\DevOps-Certificate-Generator\backend\pdf-generator\templates # Change this to your real full path
11+
path: /home/harsh/projects/DevOps-Certificate-Generator/backend/pdf-generator/templates # Change this to your real full path
1212
---
1313
apiVersion: v1
1414
kind: PersistentVolumeClaim

0 commit comments

Comments
 (0)