Files
nas-tools/.gitea/workflows/deploy.yml
T
Gan, Jimmy bce67f4ea7
Run Tests / Backend Tests (push) Failing after 4m16s
Run Tests / Frontend Tests (push) Failing after 57s
Run Tests / Backend Tests (pull_request) Failing after 3m59s
Run Tests / Frontend Tests (pull_request) Failing after 57s
Run Tests / Test Summary (push) Failing after 12s
Run Tests / Test Summary (pull_request) Failing after 13s
fix: use NAS IP for registry mirror in deploy workflow
- Change mirror_host from 127.0.0.1:5501 to 100.78.131.124:5501
- CI runner container can't access localhost, needs host IP
- Increase timeout from 60s to 120s for slower pulls
- Fixes network timeout errors in deploy.yml workflow
2026-04-08 02:32:35 +08:00

62 lines
2.1 KiB
YAML

name: Deploy Dashboard
on:
push:
branches: [main]
paths:
- 'dashboard/**'
- '.gitea/workflows/deploy.yml'
concurrency:
group: deploy-dashboard-main
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
container:
volumes:
- /var/packages/ContainerManager/target/usr/bin/docker:/usr/bin/docker
- /volume1/docker/nas-dashboard:/nas-dashboard
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Warm mirror cache for base images
run: |
set -u
# Use host.docker.internal or NAS IP to access registry mirror from container
mirror_host="100.78.131.124:5501"
if command -v curl >/dev/null 2>&1; then
if curl -fsS "http://${mirror_host}/v2/" >/dev/null; then
echo "Registry mirror is healthy at ${mirror_host}"
else
echo "Warning: registry mirror health check failed at ${mirror_host}; continuing with normal pull path"
fi
else
echo "Warning: curl is unavailable; skipping explicit mirror health check"
fi
prewarm_base_image() {
image_ref="$1"
mirror_ref="${mirror_host}/library/${image_ref}"
echo "Attempting mirror pre-pull: ${mirror_ref}"
if timeout 120 docker pull "${mirror_ref}"; then
docker tag "${mirror_ref}" "${image_ref}"
echo "Mirror pre-pull succeeded for ${image_ref}"
else
echo "Warning: mirror pre-pull failed for ${image_ref}; continuing with normal pull during build"
fi
}
prewarm_base_image "node:20-alpine"
prewarm_base_image "python:3.12-slim"
- name: Build
run: DOCKER_BUILDKIT=0 docker build -t nas-dashboard:latest dashboard/
- name: Sync runtime compose file
run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml
- name: Deploy
run: docker compose -f /nas-dashboard/docker-compose.yml up -d --pull never