fix(container): keep runtime files out of CI image
This commit is contained in:
@@ -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
@@ -9,12 +9,11 @@ RUN conda install -y -c conda-forge python=3.12 pymetis && \
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 将代码放入子目录 'app',将数据放入子目录 'db_inp'
|
# 本地数据目录和环境变量在运行时通过 Compose 挂载或注入,
|
||||||
# 这样临时文件默认会生成在 /app 下,而代码在 /app/app 下,实现了分离
|
# 不应进入镜像构建上下文。
|
||||||
|
RUN mkdir -p /app/db_inp /app/inp /app/data /app/temp
|
||||||
|
|
||||||
COPY app ./app
|
COPY app ./app
|
||||||
COPY db_inp ./db_inp
|
|
||||||
COPY temp ./temp
|
|
||||||
COPY .env .
|
|
||||||
|
|
||||||
# 设置 PYTHONPATH 以便 uvicorn 找到 app 模块
|
# 设置 PYTHONPATH 以便 uvicorn 找到 app 模块
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
|
|||||||
Reference in New Issue
Block a user