-
Notifications
You must be signed in to change notification settings - Fork 20
46 lines (37 loc) · 1.03 KB
/
docker.yaml
File metadata and controls
46 lines (37 loc) · 1.03 KB
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
36
37
38
39
40
41
42
43
44
45
46
name: Docker Image Build
on:
push:
branches-ignore:
- main
- dev
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get short commit hash
id: vars
run: echo "tag=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build the Docker image
run: docker build . --tag pesu-auth
- name: Spawn a container
run: docker run --name pesu-auth -d -p 5000:5000 pesu-auth
- name: Wait for the container to be ready
run: sleep 5
- name: Test container HTTP response
run: |
RESPONSE=$(curl --fail --max-time 10 http://localhost:5000 || echo "fail")
if [ "$RESPONSE" = "fail" ]; then
echo "❌ Container did not respond."
docker logs pesu-auth
exit 1
fi
echo "✅ Container is responsive."
- name: Stop the container
run: |
docker stop pesu-auth