From 6a1f5a9c955437caa0790ea0c4c46fd17c4056e6 Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Thu, 20 Aug 2026 12:11:23 +0800 Subject: [PATCH] =?UTF-8?q?chore(docker):=20=E7=98=A6=E8=BA=AB=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=B8=8A=E4=B8=8B=E6=96=87=E9=81=BF=E5=85=8D=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=A3=81=E7=9B=98=E4=B8=8D=E8=B6=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .dockerignore 排除 dist 除 standalone/static 外的开发与缓存产物 (dev/cache/server/node_modules 等)及服务器 dist_backup_* 备份目录, 将 docker 构建上下文从约 4.4G 降至约 200M,修复生产容器重建时 "no space left on device" 失败。 --- .dockerignore | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index b756445..fcfdf95 100644 --- a/.dockerignore +++ b/.dockerignore @@ -29,4 +29,13 @@ reports scripts.backup logs *.tar.gz -tsconfig.tsbuildinfo \ No newline at end of file +tsconfig.tsbuildinfo +# --- 构建上下文瘦身 --- +# dist 仅 Dockerfile.prod 需要 standalone 与 static 两个子目录, +# 其余(dev/cache/server/node_modules 等开发与缓存产物)会撑大构建上下文, +# 导致服务器磁盘不足(no space left on device),全部排除。 +dist/* +!dist/standalone +!dist/static +# 服务器上的 dist 版本备份目录(每个约 1.1G),不得进入构建上下文 +dist_backup_*