fix: race condition in clearing pipeline state after namespace #90
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 CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
docker-build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Remove unnecessary files | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- uses: actions/checkout@v4 | |
- name: Remove .env copy from Dockerfile | |
run: sed -i '/COPY .env/d' Dockerfile | |
- name: Build Docker image | |
run: | | |
if ! docker build -t docetl .; then | |
echo "Docker build failed" | |
exit 1 | |
fi | |
- name: Create Docker volume | |
run: docker volume create docetl-data | |
- name: Test Docker container | |
run: | | |
# Run the container in detached mode | |
docker run -d \ | |
-p 3000:3000 \ | |
-p 8000:8000 \ | |
-v docetl-data:/docetl-data \ | |
-e FRONTEND_HOST=0.0.0.0 \ | |
-e FRONTEND_PORT=3000 \ | |
-e BACKEND_HOST=0.0.0.0 \ | |
-e BACKEND_PORT=8000 \ | |
--name docetl-test \ | |
docetl | |
# Wait for initial startup | |
echo "Waiting for container to start..." | |
sleep 30 | |
frontend_healthy=false | |
# Check container health for up to 3 minutes | |
for i in {1..6}; do | |
if ! docker ps -q -f name=docetl-test > /dev/null 2>&1; then | |
echo "Container stopped unexpectedly" | |
docker logs docetl-test | |
exit 1 | |
fi | |
# Try to curl the frontend | |
if curl -s -f http://localhost:3000/playground > /dev/null; then | |
echo "Frontend is responding" | |
frontend_healthy=true | |
break | |
fi | |
if [ $i -eq 6 ]; then | |
echo "Container health check failed after 3 minutes" | |
docker logs docetl-test | |
exit 1 | |
fi | |
echo "Waiting for services to be ready... (attempt $i/6)" | |
sleep 30 | |
done | |
# Explicitly fail if frontend check never succeeded | |
if [ "$frontend_healthy" = false ]; then | |
echo "Frontend health check failed" | |
docker logs docetl-test | |
exit 1 | |
fi | |
# If we get here, container is running and healthy | |
echo "Container is running successfully" | |
# Cleanup | |
docker stop docetl-test | |
docker rm docetl-test | |
- name: Clean up Docker volume | |
run: docker volume rm docetl-data |