File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : CI/CD Static Bank Site
1+ name : CI/CD Pipeline
22
33on :
44 push :
5- branches : [ main ]
6- pull_request :
7- branches : [ main ]
5+ branches :
6+ - main
87
98jobs :
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
Original file line number Diff line number Diff line change 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;" ]
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments