-
Notifications
You must be signed in to change notification settings - Fork 292
43 lines (37 loc) · 1.24 KB
/
docker-test.yaml
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
name: Docker Test
on:
push:
branches:
- dev
- main
pull_request:
branches:
- dev
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup postgres
run: |
docker run -d --name db -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=stackframe -p 5432:5432 postgres:latest
sleep 5
docker logs db
- name: Build Docker image
run: docker build -f docker/server/Dockerfile -t server .
- name: Run Docker container and check logs
run: |
docker run --add-host=host.docker.internal:host-gateway --env-file docker/server/.env.example -p 8101:8101 -p 8102:8102 -d --name stackframe-server server
sleep 10
docker logs stackframe-server
- name: Check server health
run: |
echo "Attempting to connect to server..."
curl -v http://localhost:8101
response_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8101)
echo "Response code: $response_code"
if [ $response_code -ne 200 ]; then
echo "Server health check failed with status code: $response_code"
exit 1
fi