11---
2- name : Docker Build and Run Test
2+ name : Docker Build and Smoke Test
33
44on :
55 push :
66 branches :
77 - main
8+ paths :
9+ - " pytc-client/Dockerfile"
10+ - " pytc-client/docker-compose.yaml"
11+ - " pytc-client/scripts/docker-entrypoint.sh"
12+ - " pytc-client/setup_pytorch_connectomics.sh"
13+ - " pytc-client/pyproject.toml"
14+ - " pytc-client/uv.lock"
15+ - " pytc-client/server_api/**"
16+ - " pytc-client/server_pytc/**"
17+ pull_request :
18+ paths :
19+ - " pytc-client/Dockerfile"
20+ - " pytc-client/docker-compose.yaml"
21+ - " pytc-client/scripts/docker-entrypoint.sh"
22+ - " pytc-client/setup_pytorch_connectomics.sh"
23+ - " pytc-client/pyproject.toml"
24+ - " pytc-client/uv.lock"
25+ - " pytc-client/server_api/**"
26+ - " pytc-client/server_pytc/**"
827
928jobs :
1029 build-and-run :
1130 runs-on : ubuntu-latest
1231
1332 steps :
14- - name : Check out the repo
15- uses : actions/checkout@v2
33+ - name : Check out repository
34+ uses : actions/checkout@v4
1635
1736 - name : Set up Docker Buildx
18- uses : docker/setup-buildx-action@v1
37+ uses : docker/setup-buildx-action@v3
1938
20- - name : Initialize Git Submodules
21- run : git submodule update --init --recursive
39+ - name : Build backend image
40+ working-directory : pytc-client
41+ run : docker build -t pytc-backend .
2242
23- - name : Build Docker Image
24- run : docker build -t pytc .
43+ - name : Run backend container
44+ working-directory : pytc-client
45+ run : docker run -d --name pytc-backend -p 4242:4242 -p 4243:4243 pytc-backend
2546
26- - name : Run Docker Container
27- run : docker run --name mycontainer -d pytc
47+ - name : Wait for API health
48+ run : |
49+ for attempt in {1..30}; do
50+ if curl -fsS http://localhost:4242/hello >/tmp/hello.json; then
51+ cat /tmp/hello.json
52+ exit 0
53+ fi
54+ sleep 5
55+ done
56+ echo "API did not become ready in time"
57+ docker logs pytc-backend || true
58+ exit 1
59+
60+ - name : Check PyTC service
61+ run : |
62+ curl -fsS http://localhost:4243/hello || (docker logs pytc-backend && exit 1)
63+
64+ - name : Cleanup container
65+ if : always()
66+ run : |
67+ docker logs pytc-backend || true
68+ docker rm -f pytc-backend || true
0 commit comments