diff --git a/backend/Dockerfile b/backend/Dockerfile index 24330b2..4d66ee5 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -44,6 +44,8 @@ CMD ["uvicorn", "auth_service.app.main:app", "--host", "0.0.0.0", "--port", "800 FROM base AS api-service COPY api_service/ ./api_service/ +# api_service 代码 import 了 auth_service 的 security 模块 +COPY auth_service/ ./auth_service/ ENV PYTHONPATH=/app USER appuser diff --git a/backend/shared/config.py b/backend/shared/config.py index e6e676f..baf5cba 100644 --- a/backend/shared/config.py +++ b/backend/shared/config.py @@ -34,7 +34,11 @@ class SharedSettings(BaseSettings): class Config: case_sensitive = True + # Docker 环境下不读 .env 文件,靠 docker-compose environment 注入 + # 本地开发时 .env 文件仍然生效 env_file = ".env" + env_file_encoding = "utf-8" + extra = "ignore" shared_settings = SharedSettings() diff --git a/docker-compose.yml b/docker-compose.yml index 4e1bb67..730d5e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - # ============================================================ # Weibo-HotSign Docker Compose # 使用方式: