@@ -14,30 +14,34 @@ jobs:
14
14
- name : extract site artifact
15
15
run : |
16
16
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/
21
17
22
18
- name : Set up Docker Buildx
23
19
uses : docker/setup-buildx-action@v3
24
20
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
+
35
26
- name : Run as service and test
36
27
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 (context will be _site now)
29
+ docker compose up -d --build staging
30
+
31
+ # Wait for the health check to pass (healthcheck should handle readiness)
32
+ echo "Waiting for service to be ready..."
33
+ timeout 60 bash -c 'until curl -f http://localhost:8080/ >/dev/null 2>&1; do sleep 2; done'
34
+
35
+ # Perform the tests
36
+ set +e # Don't exit on error so we can clean up
37
+ exit_code=0
38
+
39
+ curl -I -f http://localhost:8080/ || exit_code=1
40
+ curl -I -f http://localhost:8080/construction_guide.html || exit_code=1
41
+ curl -I -f http://localhost:8080/wiki/lego || exit_code=1
42
+
43
+ # Stop the service regardless of test outcome
44
+ docker compose stop staging
45
+
46
+ # Exit with the test result
47
+ exit $exit_code
0 commit comments