t1
Some checks failed
Gitea Actions Demo / build-and-deploy (push) Failing after 3s

This commit is contained in:
changsongdong
2025-11-04 21:07:58 +08:00
parent c74ad94102
commit 5617024619
3 changed files with 52 additions and 2 deletions

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# 使用官方轻量级 Python 基础镜像
FROM python:3.10-slim
# 设置工作目录(容器内路径)
WORKDIR /app
# 将项目文件复制到容器中
COPY . /app
# (可选)如果你有 requirements.txt则先复制并安装依赖
RUN if [ -f requirements.txt ]; then \
pip install --no-cache-dir -r requirements.txt; \
fi
# 暴露服务端口(例如 Flask / FastAPI 可监听 8000
EXPOSE 8000
# 设置环境变量(防止 Python 缓存文件)
ENV PYTHONUNBUFFERED=1
# 启动命令
CMD ["python", "main.py"]