stack/.github/workflows/docker-test.yaml
Zai Shi c69307039d
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Added run docker github actions (#369)
2024-12-15 01:21:18 +01:00

44 lines
1.2 KiB
YAML

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