nextday / Dockerfile
Ethscriptions's picture
Upload 3 files
c16c1d7 verified
raw
history blame contribute delete
793 Bytes
# 使用官方 Python 基础镜像
FROM python:3.13-slim
# 创建非 root 用户 (UID 1000)
RUN useradd -m -u 1000 user
USER user
# 设置环境变量与工作目录
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
NEXTDAY_OPT_PORT=7860 \
NEXTDAY_OPT_HOST=0.0.0.0
WORKDIR $HOME/app
# 复制依赖文件并安装
COPY --chown=user requirements.txt $HOME/app/
RUN pip install --no-cache-dir -r requirements.txt
# 安装 gunicorn 用于生产环境运行
RUN pip install --no-cache-dir gunicorn
# 复制当前目录下的所有代码到容器中,并赋予 user 权限
COPY --chown=user . $HOME/app/
# 暴露 7860 端口
EXPOSE 7860
# 启动命令:通过 gunicorn 运行 app.py 中的 app 实例
CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]