feat(infra): add local pull-through mirrors for NuGet, npm, Docker Hub
docker-compose.mirror.yml: - BaGet (port 5101) → proxies nuget.org - Verdaccio (port 4873) → proxies npmjs.com - registry:2 (port 5100) → proxies Docker Hub nuget.mirror.config: points dotnet restore at http://mirror:5101 mirrors/verdaccio/config.yaml: open reads, upstream npmjs fallback CI workflow: - All container jobs: --add-host=mirror:host-gateway - dotnet restore --configfile nuget.mirror.config - npm install --registry http://mirror:4873 First run: packages fetched from upstream through the VPS. All subsequent runs: served from local disk, no CDN needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+33
-29
@@ -18,23 +18,17 @@ concurrency:
|
||||
# ubuntu-latest:docker://node:20-alpine ← CI jobs run in real Docker containers
|
||||
# self-hosted:host ← deploy runs directly on the server
|
||||
#
|
||||
# With docker:// labels:
|
||||
# - container: image: overrides the base image for the job ✅
|
||||
# - services: creates sidecar containers on the same network ✅
|
||||
# - workspace is properly mounted into the container ✅
|
||||
#
|
||||
# WHY we don't use actions/checkout@v4 in container jobs:
|
||||
# actions/checkout is a JavaScript action — the runner executes it with
|
||||
# `node index.js` INSIDE the job container.
|
||||
# actions/checkout is a JS action — needs `node` in the container.
|
||||
# mcr.microsoft.com/dotnet/sdk → no Node.js → exit 127
|
||||
# node:20-alpine → no git → checkout fails
|
||||
# Fix: plain shell git clone via http.extraheader (token never in process list).
|
||||
#
|
||||
# mcr.microsoft.com/dotnet/sdk → no Node.js → exit 127
|
||||
# node:20-alpine → no git → checkout fails
|
||||
#
|
||||
# Fix: plain shell git clone (TOKEN via http.extraheader so it never
|
||||
# appears in the process list or git log).
|
||||
#
|
||||
# deploy (self-hosted:host) runs on the runner itself which HAS node+git,
|
||||
# so actions/checkout@v4 works there normally.
|
||||
# Local mirrors (started via docker-compose.mirror.yml):
|
||||
# "mirror" hostname → host-gateway (docker bridge IP 172.17.0.1)
|
||||
# NuGet → http://mirror:5101 (BaGet — nuget.mirror.config)
|
||||
# npm → http://mirror:4873 (Verdaccio — --registry flag)
|
||||
# Docker Hub → configured in /etc/docker/daemon.json on the host
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
jobs:
|
||||
@@ -45,9 +39,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
# host-gateway → docker bridge IP (172.17.0.1); Gitea port 3000 is
|
||||
# published there, so 'gitea' hostname resolves from inside the job container
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
@@ -80,7 +74,7 @@ jobs:
|
||||
git checkout FETCH_HEAD
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore src/Meezi.API/Meezi.API.csproj
|
||||
run: dotnet restore src/Meezi.API/Meezi.API.csproj --configfile nuget.mirror.config
|
||||
|
||||
- name: Build
|
||||
run: dotnet build src/Meezi.API/Meezi.API.csproj --no-restore -c Release
|
||||
@@ -97,7 +91,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -111,7 +107,7 @@ jobs:
|
||||
git checkout FETCH_HEAD
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore src/Meezi.Admin.API/Meezi.Admin.API.csproj
|
||||
run: dotnet restore src/Meezi.Admin.API/Meezi.Admin.API.csproj --configfile nuget.mirror.config
|
||||
|
||||
- name: Build
|
||||
run: dotnet build src/Meezi.Admin.API/Meezi.Admin.API.csproj --no-restore -c Release
|
||||
@@ -122,7 +118,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-alpine
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -138,7 +136,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/dashboard
|
||||
run: npm install --legacy-peer-deps --ignore-scripts
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:4873
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/dashboard
|
||||
@@ -152,7 +150,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-alpine
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -168,7 +168,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/admin
|
||||
run: npm install --legacy-peer-deps --ignore-scripts
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:4873
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/admin
|
||||
@@ -182,7 +182,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-alpine
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -198,7 +200,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/website
|
||||
run: npm install --legacy-peer-deps --ignore-scripts
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:4873
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/website
|
||||
@@ -212,7 +214,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-alpine
|
||||
options: --add-host=gitea:host-gateway
|
||||
options: >-
|
||||
--add-host=gitea:host-gateway
|
||||
--add-host=mirror:host-gateway
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -228,7 +232,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/finder
|
||||
run: npm install --legacy-peer-deps --ignore-scripts
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:4873
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/finder
|
||||
|
||||
Reference in New Issue
Block a user