fix(anchoring): 이미지에 config.toml 미포함 — 런타임 마운트 전환·.dockerignore 신설

- Dockerfile 의 COPY config.toml* 제거: 실 시크릿이 이미지 레이어에 구워지는 문제 해소
- .dockerignore 신설로 빌드 컨텍스트에서도 config.toml 차단(이중 방어)
- docker-compose 가 ./config.toml 을 읽기 전용 마운트 — up 전에 파일이 있어야 함
  (없으면 docker 가 디렉터리를 생성해 기동 실패 — 주석·런북에 명시)
- 설정 변경 반영이 리빌드 없이 restart 로 단순화

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
민헌 2026-07-06 11:16:45 +09:00
parent 6b7526bcc3
commit ffa7dda493
3 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,11 @@
# 시크릿 — 이미지 레이어에 절대 넣지 않는다(런타임 마운트/env 주입)
config.toml
config.*.toml
__pycache__/
*.pyc
.pytest_cache/
.venv/
tests/
docs/
*.md

View File

@ -5,8 +5,8 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# config.toml 은 이미지에 넣지 않는다(시크릿이 이미지 레이어에 남음) — 런타임 마운트 또는 env 로 주입
COPY src ./src COPY src ./src
COPY config.toml* ./
ENV PYTHONPATH=/app/src \ ENV PYTHONPATH=/app/src \
PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1

View File

@ -24,6 +24,10 @@ services:
DB_HOST: host.docker.internal DB_HOST: host.docker.internal
REDIS_HOST: anchoring-redis REDIS_HOST: anchoring-redis
TZ: Asia/Seoul TZ: Asia/Seoul
volumes:
# config.toml(시크릿)은 이미지에 안 굽고 런타임 마운트 — 없으면 파일을 먼저 만들 것
# (cp config.toml.example config.toml — 없이 up 하면 docker 가 디렉터리를 만들어 기동 실패)
- ./config.toml:/app/config.toml:ro
depends_on: depends_on:
- anchoring-redis - anchoring-redis
restart: unless-stopped restart: unless-stopped