deploy: harden compose harness

This commit is contained in:
dela
2026-05-24 21:18:19 +08:00
parent ea22d06dab
commit 542eeefdbd
9 changed files with 110 additions and 13 deletions

61
.dockerignore Normal file
View File

@@ -0,0 +1,61 @@
# cryptoHermes .dockerignore
#
# 作用:缩小 docker build context、防止敏感文件.env进入 builder layer。
# Docker 的 .dockerignore 语法和 .gitignore 类似,但**作用域是 build context**
# 不是 git 工作区——所以即使某文件没在 .gitignore 里,只要它出现在 COPY .
# 的源目录,就会被发到 daemon 并可能缓存到远端 registry。
#
# 修改本文件后跑 `docker build --progress=plain .` 看 "transferring context"
# 一行的大小变化,确认未泄漏。
# ---- 密钥 / 环境变量 ----
# 高危:.env 内含 POSTGRES_PASSWORD、可能含代理凭据。绝不能进 build context。
# .env.example 也排掉——镜像运行时不读它(环境变量由 docker compose 注入)。
.env
.env.*
# ---- Git / 工具元数据 ----
.git
.gitignore
.gitattributes
# ---- 本机构建产物 ----
bin/
*.exe
*.test
# ---- 测试覆盖率产物 ----
*.out
coverage.*
# ---- 运行时数据(容器外挂载,不进镜像)----
logs/
# ---- 编辑器 / IDE ----
.vscode/
.idea/
.claude/
*.swp
.DS_Store
Thumbs.db
# ---- Docker 自身(镜像里用不到)----
Dockerfile
.dockerignore
docker-compose.yml
docker-compose.*.yml
# ---- 文档与工程治理(不需要进镜像)----
README.md
AGENTS.md
docs/
ai/
# ---- Migration 文件 ----
# 镜像里不需要migrate init container 走宿主机 bind mount 读 ./migrations
# app 二进制本身不解析 migration。
# 如果未来要把 migration 嵌进 app 做 self-migrate再删掉这一行。
migrations/
# ---- Go ----
vendor/