Skip to content

Commit 9ee47dc

Browse files
author
Emmanuela Opurum
committed
update workflow
1 parent bccf91b commit 9ee47dc

5 files changed

Lines changed: 59 additions & 26 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
name: CI/CD Static Bank Site
1+
name: CI/CD Pipeline
22

33
on:
44
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
5+
branches:
6+
- main
87

98
jobs:
10-
build-and-deploy:
9+
build:
1110
runs-on: ubuntu-latest
12-
1311
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v3
16-
17-
- name: Set up Node.js
18-
uses: actions/setup-node@v3
19-
with:
20-
node-version: '18'
21-
22-
- name: Install dependencies
23-
run: npm install
24-
25-
- name: Build site (optional for static site)
26-
run: npm run build || echo "No build step needed for static site"
12+
- name: Checkout code
13+
uses: actions/checkout@v4
2714

28-
- name: Test (optional)
29-
run: npm run test || echo "No tests defined"
15+
- name: Upload site as artifact
16+
uses: actions/upload-artifact@v4
17+
with:
18+
name: static-site
19+
path: ./
3020

31-
- name: Deploy to GitHub Pages
32-
uses: peaceiris/actions-gh-pages@v4
33-
with:
34-
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: ./ # your static site root folder

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Use a lightweight web server image
2+
FROM nginx:alpine
3+
4+
# Remove default nginx content
5+
RUN rm -rf /usr/share/nginx/html/*
6+
7+
# Copy your static site files into the container
8+
COPY . /usr/share/nginx/html
9+
10+
# Expose port 80
11+
EXPOSE 80
12+
13+
# Start Nginx
14+
CMD ["nginx", "-g", "daemon off;"]

k8s/deployment.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: bank-site-deployment
5+
labels:
6+
app: bank-site
7+
spec:
8+
replicas: 2
9+
selector:
10+
matchLabels:
11+
app: bank-site
12+
template:
13+
metadata:
14+
labels:
15+
app: bank-site
16+
spec:
17+
containers:
18+
- name: bank-site
19+
image: emma2323/bank-cicd-site:latest
20+
ports:
21+
- containerPort: 80

k8s/service.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: bank-site-service
5+
spec:
6+
selector:
7+
app: bank-site
8+
type: NodePort
9+
ports:
10+
- protocol: TCP
11+
port: 80
12+
targetPort: 80
13+
nodePort: 30080

kind

9.47 MB
Binary file not shown.

0 commit comments

Comments
 (0)