Raw project query #181
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |