[{"data":1,"prerenderedAt":647,"buildId":648},["ShallowReactive",2],{"-docs-deployment-github-actions-description":3,"docs--docs-deployment-github-actions":16,"docs-navigation-zh-CN":553,"surround--docs-deployment-github-actions":644},{"data":4,"body":5},{},{"type":6,"children":7},"root",[8],{"type":9,"tag":10,"props":11,"children":12},"element","p",{},[13],{"type":14,"value":15},"text","用 GitHub Actions 发布镜像到 GHCR，解释镜像版本与容器重建后的反代行为。",{"id":17,"title":18,"body":19,"category":533,"description":15,"difficulty":534,"extension":535,"index":536,"keywords":534,"links":537,"meta":546,"navigation":534,"path":548,"requires":534,"seo":549,"sitemap":550,"stem":551,"__hash__":552},"docs\u002Fdocs\u002F2.deployment\u002F4.github-actions.md","GitHub Actions 发布容器镜像",{"type":20,"value":21,"toc":529},"minimark",[22,27,419,434,437,441,444,510,525],[23,24,26],"h2",{"id":25},"构建并推送-ghcr","构建并推送 GHCR",[28,29,35],"pre",{"className":30,"code":31,"filename":32,"language":33,"meta":34,"style":34},"language-yaml shiki shiki-themes github-light github-light github-dark","name: Deploy\n\non:\n  push:\n    branches:\n      - main\n\nenv:\n  REGISTRY: ghcr.io\n  IMAGE: ghcr.io\u002F${{ github.repository }}\n\npermissions:\n  contents: read\n  packages: write\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    timeout-minutes: 20\n\n    steps:\n      - uses: actions\u002Fcheckout@v6\n      - uses: docker\u002Fsetup-buildx-action@v4\n\n      - name: Log in to GHCR\n        uses: docker\u002Flogin-action@v4\n        with:\n          registry: ${{ env.REGISTRY }}\n          username: ${{ github.actor }}\n          password: ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Build and push Docker image\n        uses: docker\u002Fbuild-push-action@v7\n        with:\n          context: .\n          push: true\n          tags: |\n            ${{ env.IMAGE }}:latest\n            ${{ env.IMAGE }}:${{ github.sha }}\n          cache-from: type=gha\n          cache-to: type=gha,mode=max\n",".github\u002Fworkflows\u002Fdeploy.yml","yaml","",[36,37,38,55,62,72,80,88,97,102,110,121,132,137,145,156,167,172,180,188,199,210,215,223,236,248,253,265,276,284,295,306,317,322,334,344,351,362,373,385,391,397,408],"code",{"__ignoreMap":34},[39,40,43,47,51],"span",{"class":41,"line":42},"line",1,[39,44,46],{"class":45},"sovSZ","name",[39,48,50],{"class":49},"sxrX7",": ",[39,52,54],{"class":53},"sIIMD","Deploy\n",[39,56,58],{"class":41,"line":57},2,[39,59,61],{"emptyLinePlaceholder":60},true,"\n",[39,63,65,69],{"class":41,"line":64},3,[39,66,68],{"class":67},"sBjJW","on",[39,70,71],{"class":49},":\n",[39,73,75,78],{"class":41,"line":74},4,[39,76,77],{"class":45},"  push",[39,79,71],{"class":49},[39,81,83,86],{"class":41,"line":82},5,[39,84,85],{"class":45},"    branches",[39,87,71],{"class":49},[39,89,91,94],{"class":41,"line":90},6,[39,92,93],{"class":49},"      - ",[39,95,96],{"class":53},"main\n",[39,98,100],{"class":41,"line":99},7,[39,101,61],{"emptyLinePlaceholder":60},[39,103,105,108],{"class":41,"line":104},8,[39,106,107],{"class":45},"env",[39,109,71],{"class":49},[39,111,113,116,118],{"class":41,"line":112},9,[39,114,115],{"class":45},"  REGISTRY",[39,117,50],{"class":49},[39,119,120],{"class":53},"ghcr.io\n",[39,122,124,127,129],{"class":41,"line":123},10,[39,125,126],{"class":45},"  IMAGE",[39,128,50],{"class":49},[39,130,131],{"class":53},"ghcr.io\u002F${{ github.repository }}\n",[39,133,135],{"class":41,"line":134},11,[39,136,61],{"emptyLinePlaceholder":60},[39,138,140,143],{"class":41,"line":139},12,[39,141,142],{"class":45},"permissions",[39,144,71],{"class":49},[39,146,148,151,153],{"class":41,"line":147},13,[39,149,150],{"class":45},"  contents",[39,152,50],{"class":49},[39,154,155],{"class":53},"read\n",[39,157,159,162,164],{"class":41,"line":158},14,[39,160,161],{"class":45},"  packages",[39,163,50],{"class":49},[39,165,166],{"class":53},"write\n",[39,168,170],{"class":41,"line":169},15,[39,171,61],{"emptyLinePlaceholder":60},[39,173,175,178],{"class":41,"line":174},16,[39,176,177],{"class":45},"jobs",[39,179,71],{"class":49},[39,181,183,186],{"class":41,"line":182},17,[39,184,185],{"class":45},"  deploy",[39,187,71],{"class":49},[39,189,191,194,196],{"class":41,"line":190},18,[39,192,193],{"class":45},"    runs-on",[39,195,50],{"class":49},[39,197,198],{"class":53},"ubuntu-latest\n",[39,200,202,205,207],{"class":41,"line":201},19,[39,203,204],{"class":45},"    timeout-minutes",[39,206,50],{"class":49},[39,208,209],{"class":67},"20\n",[39,211,213],{"class":41,"line":212},20,[39,214,61],{"emptyLinePlaceholder":60},[39,216,218,221],{"class":41,"line":217},21,[39,219,220],{"class":45},"    steps",[39,222,71],{"class":49},[39,224,226,228,231,233],{"class":41,"line":225},22,[39,227,93],{"class":49},[39,229,230],{"class":45},"uses",[39,232,50],{"class":49},[39,234,235],{"class":53},"actions\u002Fcheckout@v6\n",[39,237,239,241,243,245],{"class":41,"line":238},23,[39,240,93],{"class":49},[39,242,230],{"class":45},[39,244,50],{"class":49},[39,246,247],{"class":53},"docker\u002Fsetup-buildx-action@v4\n",[39,249,251],{"class":41,"line":250},24,[39,252,61],{"emptyLinePlaceholder":60},[39,254,256,258,260,262],{"class":41,"line":255},25,[39,257,93],{"class":49},[39,259,46],{"class":45},[39,261,50],{"class":49},[39,263,264],{"class":53},"Log in to GHCR\n",[39,266,268,271,273],{"class":41,"line":267},26,[39,269,270],{"class":45},"        uses",[39,272,50],{"class":49},[39,274,275],{"class":53},"docker\u002Flogin-action@v4\n",[39,277,279,282],{"class":41,"line":278},27,[39,280,281],{"class":45},"        with",[39,283,71],{"class":49},[39,285,287,290,292],{"class":41,"line":286},28,[39,288,289],{"class":45},"          registry",[39,291,50],{"class":49},[39,293,294],{"class":53},"${{ env.REGISTRY }}\n",[39,296,298,301,303],{"class":41,"line":297},29,[39,299,300],{"class":45},"          username",[39,302,50],{"class":49},[39,304,305],{"class":53},"${{ github.actor }}\n",[39,307,309,312,314],{"class":41,"line":308},30,[39,310,311],{"class":45},"          password",[39,313,50],{"class":49},[39,315,316],{"class":53},"${{ secrets.GITHUB_TOKEN }}\n",[39,318,320],{"class":41,"line":319},31,[39,321,61],{"emptyLinePlaceholder":60},[39,323,325,327,329,331],{"class":41,"line":324},32,[39,326,93],{"class":49},[39,328,46],{"class":45},[39,330,50],{"class":49},[39,332,333],{"class":53},"Build and push Docker image\n",[39,335,337,339,341],{"class":41,"line":336},33,[39,338,270],{"class":45},[39,340,50],{"class":49},[39,342,343],{"class":53},"docker\u002Fbuild-push-action@v7\n",[39,345,347,349],{"class":41,"line":346},34,[39,348,281],{"class":45},[39,350,71],{"class":49},[39,352,354,357,359],{"class":41,"line":353},35,[39,355,356],{"class":45},"          context",[39,358,50],{"class":49},[39,360,361],{"class":67},".\n",[39,363,365,368,370],{"class":41,"line":364},36,[39,366,367],{"class":45},"          push",[39,369,50],{"class":49},[39,371,372],{"class":67},"true\n",[39,374,376,379,381],{"class":41,"line":375},37,[39,377,378],{"class":45},"          tags",[39,380,50],{"class":49},[39,382,384],{"class":383},"s8jYJ","|\n",[39,386,388],{"class":41,"line":387},38,[39,389,390],{"class":53},"            ${{ env.IMAGE }}:latest\n",[39,392,394],{"class":41,"line":393},39,[39,395,396],{"class":53},"            ${{ env.IMAGE }}:${{ github.sha }}\n",[39,398,400,403,405],{"class":41,"line":399},40,[39,401,402],{"class":45},"          cache-from",[39,404,50],{"class":49},[39,406,407],{"class":53},"type=gha\n",[39,409,411,414,416],{"class":41,"line":410},41,[39,412,413],{"class":45},"          cache-to",[39,415,50],{"class":49},[39,417,418],{"class":53},"type=gha,mode=max\n",[10,420,421,422,425,426,429,430,433],{},"工作流使用 ",[36,423,424],{},"GITHUB_TOKEN"," 和 ",[36,427,428],{},"packages: write"," 发布镜像。已有 GHCR 包如果报 ",[36,431,432],{},"permission_denied: write_package","，到包的设置检查仓库关联和 Actions 权限。发布时同时保留提交 SHA 标签，部署和回滚可明确选择具体版本。",[10,435,436],{},"构建确实需要凭证时，用 BuildKit secret 挂载。运行时凭证由容器运行环境注入。",[23,438,440],{"id":439},"容器重建时保持-nginx-可启动","容器重建时保持 Nginx 可启动",[10,442,443],{},"在同一个 Docker 自定义网络里，Nginx 可以通过容器名访问应用。使用 Docker 内置 DNS 和变量形式的上游，让 Nginx 在请求时解析应用容器：",[28,445,449],{"className":446,"code":447,"language":448,"meta":34,"style":34},"language-nginx shiki shiki-themes github-light github-light github-dark","location \u002F {\n    resolver 127.0.0.11 valid=30s;\n    set $upstream app:3000;\n    proxy_pass http:\u002F\u002F$upstream;\n    proxy_set_header Host $host;\n    proxy_set_header X-Forwarded-Proto $scheme;\n}\n","nginx",[36,450,451,463,474,482,490,498,505],{"__ignoreMap":34},[39,452,453,456,460],{"class":41,"line":42},[39,454,455],{"class":383},"location",[39,457,459],{"class":458},"snPdu"," \u002F ",[39,461,462],{"class":49},"{\n",[39,464,465,468,471],{"class":41,"line":57},[39,466,467],{"class":383},"    resolver ",[39,469,470],{"class":67},"127.0.0.11",[39,472,473],{"class":49}," valid=30s;\n",[39,475,476,479],{"class":41,"line":64},[39,477,478],{"class":383},"    set ",[39,480,481],{"class":49},"$upstream app:3000;\n",[39,483,484,487],{"class":41,"line":74},[39,485,486],{"class":383},"    proxy_pass ",[39,488,489],{"class":49},"http:\u002F\u002F$upstream;\n",[39,491,492,495],{"class":41,"line":82},[39,493,494],{"class":383},"    proxy_set_header ",[39,496,497],{"class":49},"Host $host;\n",[39,499,500,502],{"class":41,"line":90},[39,501,494],{"class":383},[39,503,504],{"class":49},"X-Forwarded-Proto $scheme;\n",[39,506,507],{"class":41,"line":99},[39,508,509],{"class":49},"}\n",[10,511,512,513,516,517,524],{},"应用未就绪时请求仍可能返回 ",[36,514,515],{},"502","。用实际 HTTP 请求确认发布后的应用可用。本文早期方案依赖 Watchtower 自动拉取镜像，其",[518,519,523],"a",{"href":520,"rel":521},"https:\u002F\u002Fgithub.com\u002Fcontainrrr\u002Fwatchtower",[522],"nofollow","原仓库","已归档。",[526,527,528],"style",{},"html pre.shiki code .sovSZ, html code.shiki .sovSZ{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .sxrX7, html code.shiki .sxrX7{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sIIMD, html code.shiki .sIIMD{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sBjJW, html code.shiki .sBjJW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s8jYJ, html code.shiki .s8jYJ{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#F97583}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .snPdu, html code.shiki .snPdu{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":34,"searchDepth":57,"depth":64,"links":530},[531,532],{"id":25,"depth":57,"text":26},{"id":439,"depth":57,"text":440},"ci",null,"md",false,[538,542],{"label":539,"icon":540,"to":541},"GitHub 发布容器镜像","i-simple-icons-github","https:\u002F\u002Fdocs.github.com\u002Fen\u002Factions\u002Ftutorials\u002Fpublish-packages\u002Fpublish-docker-images",{"label":543,"icon":544,"to":545},"Nginx resolver 文档","i-lucide-book-open","https:\u002F\u002Fnginx.org\u002Fen\u002Fdocs\u002Fhttp\u002Fngx_http_core_module.html#resolver",{"date":547},"2026-11-30T17:42:46+08:00","\u002Fdocs\u002Fdeployment\u002Fgithub-actions",{"title":18,"description":15},{"loc":548},"docs\u002F2.deployment\u002F4.github-actions","OhzAnnVe_yJyY8A_bcBYQq_obkSYtkhvyugJJ5Kmdek",[554],{"title":555,"path":556,"stem":557,"children":558,"page":536},"Docs","\u002Fdocs","docs",[559,581,615,632],{"title":560,"category":534,"description":561,"icon":562,"date":547,"path":563,"stem":564,"children":565,"page":536},"Nuxt 工程","Nuxt UI 样式、身份认证与 SSR 部署的排查记录","i-simple-icons-nuxt","\u002Fdocs\u002Fnuxt","docs\u002F1.nuxt",[566,571,576],{"title":567,"path":568,"stem":569,"category":534,"description":570},"Nuxt UI componentDetection 漏检","\u002Fdocs\u002Fnuxt\u002Fnuxt-ui-component-detection","docs\u002F1.nuxt\u002F1.nuxt-ui-component-detection","解决 @nuxt\u002Fui 开启 componentDetection 后，部分组件主题 CSS 未生成、样式完全缺失的问题。",{"title":572,"path":573,"stem":574,"category":534,"description":575},"自建服务器 GitHub OAuth 回调 500 排查","\u002Fdocs\u002Fnuxt\u002Fself-hosted-oauth-500","docs\u002F1.nuxt\u002F2.self-hosted-oauth-500","汇总自建 Docker + nginx 环境下 \u002Fauth\u002Fgithub 回调返回 500 的三种独立根因——出海代理超时、数据库连接串在构建期被固化、跨 Docker 网络 DNS 解析失败，提供速查表快速定位与逐一修复步骤。",{"title":577,"path":578,"stem":579,"category":534,"description":580},"Nuxt SSR + PM2 部署","\u002Fdocs\u002Fnuxt\u002Fssr-pm2-deploy","docs\u002F1.nuxt\u002F3.ssr-pm2-deploy","在宿主机用 PM2 集群运行 Nuxt SSR，并通过 Docker Nginx 反向代理与 Cloudflare 避坑要点。",{"title":582,"category":534,"description":583,"icon":584,"date":547,"path":585,"stem":586,"children":587,"page":536},"部署与运维","容器、数据库、证书与自动化发布","i-lucide-server","\u002Fdocs\u002Fdeployment","docs\u002F2.deployment",[588,594,599,604,605,610],{"title":589,"path":590,"stem":591,"category":592,"description":593},"Docker Nginx 反向代理","\u002Fdocs\u002Fdeployment\u002Fdocker","docs\u002F2.deployment\u002F1.docker","infra","用 Docker Compose 部署 Nginx，配置同网络容器或宿主机反向代理，并排查常见网络问题。",{"title":595,"path":596,"stem":597,"category":592,"description":598},"数据库部署","\u002Fdocs\u002Fdeployment\u002Fdatabase","docs\u002F2.deployment\u002F2.database","使用 Docker Compose 本地监听部署 PostgreSQL 与 Redis，配置备份恢复、PostGIS 及 Redis 持久化。",{"title":600,"path":601,"stem":602,"category":592,"description":603},"SSL 证书配置","\u002Fdocs\u002Fdeployment\u002Fssl-certificate","docs\u002F2.deployment\u002F3.ssl-certificate","Cloudflare Origin 证书与 Let's Encrypt（acme.sh）选型配置、Nginx HTTPS 片段与常见 TLS 故障排查。",{"title":18,"path":548,"stem":551,"category":533,"description":15},{"title":606,"path":607,"stem":608,"category":533,"description":609},"GitHub CI 镜像加速","\u002Fdocs\u002Fdeployment\u002Fgithub-ci-mirror-acceleration","docs\u002F2.deployment\u002F5.github-ci-mirror-acceleration","在国内云服务器上通过同步腾讯云 TCR 或配置 Mihomo 代理，加速拉取 GitHub Actions 构建的容器镜像。",{"title":611,"path":612,"stem":613,"category":533,"description":614},"GitLab CI\u002FCD 排查","\u002Fdocs\u002Fdeployment\u002Fgitlab-ci","docs\u002F2.deployment\u002F6.gitlab-ci","记录 GitLab CI 配置加载、构建产物和部署通知之间的依赖关系。",{"title":616,"category":534,"description":617,"icon":618,"date":547,"path":619,"stem":620,"children":621,"page":536},"平台集成","地图服务与政务应用接入中的实际问题","i-lucide-plug","\u002Fdocs\u002Fplatforms","docs\u002F3.platforms",[622,627],{"title":623,"path":624,"stem":625,"category":534,"description":626},"iServer 踩坑归集","\u002Fdocs\u002Fplatforms\u002Fiserver","docs\u002F3.platforms\u002F1.iserver","记录使用超图 iServer 地图与数据服务过程中的接口选型、常见问题排查与实用查询技巧。",{"title":628,"path":629,"stem":630,"category":534,"description":631},"浙政钉 H5 应用埋点","\u002Fdocs\u002Fplatforms\u002Fdingtalk","docs\u002F3.platforms\u002F2.dingtalk","在浙政钉 H5 单页应用中配置 aplus_queue 手动采集，按路由发送 PV 并安全绑定异步用户信息。",{"title":633,"category":534,"description":634,"icon":635,"date":547,"path":636,"stem":637,"children":638,"page":536},"开发环境与工具","pnpm 供应链策略与版本自举等工具链排错记录","i-lucide-wrench","\u002Fdocs\u002Ftools","docs\u002F4.tools",[639],{"title":640,"path":641,"stem":642,"category":534,"description":643},"pnpm 常见故障排查","\u002Fdocs\u002Ftools\u002Fpnpm","docs\u002F4.tools\u002F1.pnpm","通过错误信息区分依赖信任降级阻断（ERR_PNPM_TRUST_DOWNGRADE）与 pnpm 自举崩溃。",[645,646],{"title":600,"path":601,"stem":602,"description":603,"children":-1},{"title":606,"path":607,"stem":608,"description":609,"children":-1},1796031846692,"fbd03a9e-6514-4b03-ba93-9f40ff4dbee5"]