@@ -14,30 +14,31 @@ jobs:
1414 - name : extract site artifact
1515 run : |
1616 tar -xzf _site.tar.gz
17- - name : Prepare for docker build
18- run : |
19- cp .github/scripts/staging/Dockerfile _site/
20- cp .github/scripts/staging/http2.conf _site/
2117
2218 - name : Set up Docker Buildx
2319 uses : docker/setup-buildx-action@v3
2420
25- - name : Build the container
26- uses : docker/build-push-action@v6
27- with :
28- context : " _site"
29- tags : orionrobots:latest
30- cache-from : type=gha
31- cache-to : type=gha,mode=max
32- push : false
33- load : true
34-
21+ - name : Prepare staging context
22+ run : |
23+ # Copy staging files into the _site directory for the docker build
24+ cp .github/scripts/staging/default.conf _site/httpd.conf
25+
3526 - name : Run as service and test
3627 run : |
37- docker run --rm -d -p8080:80 --name orionrobots orionrobots:latest
38- # Wait for the service to start
39- sleep 10
40- curl -I -L -f http://localhost:8080/
41- curl -I -L -f http://localhost:8080/construction_guide.html
42- curl -I -L -f http://localhost:8080/wiki/lego
43- docker stop orionrobots
28+ # Start the staging service using docker compose with --wait for health checks
29+ # Use CI-specific override for GitHub Actions cache
30+ docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d --build --wait staging
31+
32+ # Perform the tests
33+ set +e # Don't exit on error so we can clean up
34+ exit_code=0
35+
36+ curl -I -f http://localhost:8080/ || exit_code=1
37+ curl -I -f http://localhost:8080/construction_guide.html || exit_code=1
38+ curl -I -f http://localhost:8080/wiki/lego || exit_code=1
39+
40+ # Stop the service regardless of test outcome
41+ docker compose -f docker-compose.yml -f docker-compose.ci.yml stop staging
42+
43+ # Exit with the test result
44+ exit $exit_code
0 commit comments