-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (28 loc) · 786 Bytes
/
Copy pathdeploy.yml
File metadata and controls
35 lines (28 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: DevOps Practice CI/CD
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: |
docker build -t hello-devops .
- name: Run Docker container
run: |
docker run -d -p 8080:80 --name hello-devops hello-devops
sleep 5
- name: Test application
run: |
curl -I http://localhost:8080 | grep "200 OK"
- name: Stop and remove container
run: |
docker stop hello-devops || true
docker rm hello-devops || true