30 lines
684 B
Docker
30 lines
684 B
Docker
# 开发环境 Dockerfile
|
|
|
|
FROM python:3.11.9-slim
|
|
|
|
# 配置阿里云源
|
|
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
# 安装依赖
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 配置 pip
|
|
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装依赖
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 设置环境变量
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
TZ=Asia/Shanghai
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|