Author SHA1 Message Date
TJWater CI 3d0af38c8c fix(container): keep runtime files out of CI image
Generic Container CI/CD / test-build-publish (push) Successful in 11m15s
Server CI/CD v2 / build-test-publish-and-deploy (push) Successful in 11m15s
2026-08-11 10:10:37 +08:00
2 changed files with 25 additions and 5 deletions
+21
View File
@@ -0,0 +1,21 @@
.git
.github
.gitea
__pycache__/
.pytest_cache/
.mypy_cache/
.venv/
venv/
build/
dist/
package/
.env
.env.*
db_inp/
inp/
temp/
data/
logs/
coverage/
*.pyc
*.dump
+4 -5
View File
@@ -9,12 +9,11 @@ RUN conda install -y -c conda-forge python=3.12 pymetis && \
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 将代码放入子目录 'app',将数据放入子目录 'db_inp'
# 这样临时文件默认会生成在 /app 下,而代码在 /app/app 下,实现了分离
# 本地数据目录和环境变量在运行时通过 Compose 挂载或注入,
# 不应进入镜像构建上下文。
RUN mkdir -p /app/db_inp /app/inp /app/data /app/temp
COPY app ./app
COPY db_inp ./db_inp
COPY temp ./temp
COPY .env .
# 设置 PYTHONPATH 以便 uvicorn 找到 app 模块
ENV PYTHONPATH=/app