import project
All checks were successful
Gitea Actions Demo / deploy (push) Successful in 35s

This commit is contained in:
2025-11-20 21:41:13 +08:00
commit 32d15e8c92
21 changed files with 401 additions and 0 deletions

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
# 使用官方轻量级 Python 基础镜像
FROM python:3.12-slim
# 时区(可选)
ENV TZ=Asia/Shanghai
# 设置工作目录(容器内路径)
WORKDIR /app
# 将项目文件复制到容器中
COPY . /app
# (可选)如果你有 requirements.txt则先复制并安装依赖
RUN if [ -f requirements.txt ]; then \
pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/; \
fi
# 设置环境变量(防止 Python 缓存文件)
ENV PYTHONUNBUFFERED=1
# 暴露端口
EXPOSE 8000
#----------------------------
# 启动 FastAPI生产模式
#----------------------------
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]