Files
2026-05-16 19:03:44 +08:00

29 lines
817 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 使用 Python 3.11 slim 镜像作为基础镜像
FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
# 设置环境变量
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
TZ=Asia/Shanghai
# 复制依赖文件
COPY requirements.txt .
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 复制应用代码(笔记目录在仓库中为 data/mengyanote运行时挂载到 /app/mengyanote 与 main.py 一致)
COPY main.py .
COPY data/mengyanote ./mengyanote
# 默认配置config.json 含 admin_tokenignore.json。部署可用卷覆盖整个目录
COPY data/config ./data/config
# 暴露端口
EXPOSE 8000
# 启动命令
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]