milestone 11: systemd and docker packaging, operator and architecture docs, config and api reference, docs drift guards
This commit is contained in:
@@ -136,3 +136,83 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Zig
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: ${{ env.ZIG_VERSION }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: npm
|
||||
cache-dependency-path: web/package-lock.json
|
||||
|
||||
- name: Build the web UI
|
||||
working-directory: web
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Build static musl executables
|
||||
run: zig build cross -Dweb-dist=web/dist -Doptimize=ReleaseSafe
|
||||
|
||||
- name: Build the image
|
||||
run: docker build -t nxdns:ci -f deploy/docker/Dockerfile .
|
||||
|
||||
- name: Smoke test the container
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
docker run --rm nxdns:ci version
|
||||
|
||||
mkdir -p etc-nxdns
|
||||
cat > etc-nxdns/config.zon <<'EOF'
|
||||
.{
|
||||
.groups = .{ .{ .name = "default" } },
|
||||
.upstreams = .{ .{ .url = "https://cloudflare-dns.com/dns-query" } },
|
||||
}
|
||||
EOF
|
||||
|
||||
cid=$(docker run -d --name nxdns-smoke \
|
||||
-p 127.0.0.1:8080:8080 \
|
||||
-v "$PWD/etc-nxdns:/etc/nxdns:ro" \
|
||||
nxdns:ci)
|
||||
trap 'docker rm -f nxdns-smoke >/dev/null 2>&1 || true' EXIT
|
||||
|
||||
# The published port works when the job runs on the docker host or in
|
||||
# DinD; the container IP covers a runner that shares the daemon over
|
||||
# a mounted socket.
|
||||
ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid")
|
||||
healthy=""
|
||||
for _ in $(seq 1 30); do
|
||||
if [ "$(docker inspect -f '{{.State.Running}}' "$cid")" != "true" ]; then
|
||||
echo "container exited during startup"
|
||||
docker logs "$cid" || true
|
||||
exit 1
|
||||
fi
|
||||
if curl -fsS "http://127.0.0.1:8080/api/health" \
|
||||
|| { [ -n "$ip" ] && curl -fsS "http://$ip:8080/api/health"; }; then
|
||||
healthy=1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ -z "$healthy" ]; then
|
||||
echo "no /api/health response within 30 seconds"
|
||||
docker logs "$cid" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker stop -t 30 nxdns-smoke
|
||||
exit_code=$(docker inspect -f '{{.State.ExitCode}}' nxdns-smoke)
|
||||
echo "exit code after SIGTERM: $exit_code"
|
||||
docker logs nxdns-smoke || true
|
||||
test "$exit_code" -eq 0
|
||||
|
||||
Reference in New Issue
Block a user