Skip to content

Commit 6456891

Browse files
f3l1xclaude
andcommitted
Add GitHub Actions workflow for Docker build and test
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a240f9d commit 6456891

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: "Docker"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: ["master"]
8+
9+
schedule:
10+
- cron: "0 8 * * 1"
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
test:
17+
name: "Test"
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Build image for testing
27+
uses: docker/build-push-action@v6
28+
with:
29+
context: .
30+
file: ./Dockerfile
31+
push: false
32+
tags: dockette/apidoc:latest-test
33+
platforms: linux/amd64
34+
cache-from: type=gha
35+
cache-to: type=gha,mode=max
36+
load: true
37+
38+
- name: Test Caddy is running
39+
run: |
40+
docker run --rm -d --name apidoc-test -p 8000:8000 dockette/apidoc:latest-test
41+
sleep 2
42+
curl -sf http://localhost:8000/ > /dev/null
43+
echo "Landing page OK"
44+
45+
- name: Test Swagger UI
46+
run: |
47+
curl -sf http://localhost:8000/swagger/ > /dev/null
48+
echo "Swagger UI OK"
49+
50+
- name: Test Redoc
51+
run: |
52+
curl -sf http://localhost:8000/redoc/ > /dev/null
53+
echo "Redoc OK"
54+
55+
- name: Test Stoplight Elements
56+
run: |
57+
curl -sf http://localhost:8000/elements/ > /dev/null
58+
echo "Stoplight Elements OK"
59+
60+
- name: Test RapiDoc
61+
run: |
62+
curl -sf http://localhost:8000/rapidoc/ > /dev/null
63+
echo "RapiDoc OK"
64+
65+
- name: Test Scalar
66+
run: |
67+
curl -sf http://localhost:8000/scalar/ > /dev/null
68+
echo "Scalar OK"
69+
70+
- name: Cleanup
71+
if: always()
72+
run: docker stop apidoc-test || true
73+
74+
build:
75+
name: "Build"
76+
needs: test
77+
uses: dockette/.github/.github/workflows/docker.yml@master
78+
secrets: inherit
79+
with:
80+
image: "dockette/apidoc"
81+
tag: "latest"
82+
context: "."
83+
platforms: "linux/amd64,linux/arm64"
84+
push: ${{ github.ref == 'refs/heads/master' }}

0 commit comments

Comments
 (0)