Update README.md #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 使用官方 Python 基础镜像 | ||
FROM python:3.9-slim | ||
# 设置工作目录 | ||
WORKDIR /app | ||
# 设置环境变量 | ||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
TZ=Asia/Shanghai | ||
# 安装系统依赖 | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
libmagic1 \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \ | ||
&& echo ${TZ} > /etc/timezone | ||
# 复制项目文件 | ||
COPY requirements.txt . | ||
# 安装Python依赖 | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
# 复制应用程序代码 | ||
COPY . . | ||
# 创建必要的目录 | ||
RUN mkdir -p static/audio \ | ||
&& chmod -R 755 static | ||
# 暴露端口 | ||
EXPOSE 8005 | ||
# 启动命令 | ||
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8005"] |