zhaoqingang
2025-04-10 9ea07e00fc8b92e9b75849859c1ecce77c7096d1
Dockerfile
@@ -1,14 +1,12 @@
FROM python:3.11
# 安装 PyInstaller
RUN pip install pyinstaller
# 复制项目文件到容器中
COPY . /app
# 设置工作目录
WORKDIR /app
# copy文件到容器
COPY . /app
# 安装项目依赖
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 使用 PyInstaller 打包应用,并确保文件被复制到 dist 目录
RUN pyinstaller -F main.py
# 启动命令
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9201"]