29 lines
1.1 KiB
Docker
29 lines
1.1 KiB
Docker
# FROM python:3.12-slim
|
||
FROM python:3.11-bookworm
|
||
|
||
|
||
RUN rm -f /etc/apt/sources.list.d/* \
|
||
&& echo "deb https://mirrors.aliyun.com/debian bookworm main" > /etc/apt/sources.list \
|
||
&& echo "deb https://mirrors.aliyun.com/debian bookworm-updates main" >> /etc/apt/sources.list \
|
||
&& echo "deb https://mirrors.aliyun.com/debian-security bookworm-security main" >> /etc/apt/sources.list \
|
||
&& apt-get update \
|
||
&& apt-get install -y ffmpeg build-essential git default-mysql-client \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
ENV TZ=Asia/Shanghai
|
||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||
|
||
WORKDIR /app
|
||
|
||
COPY requirements.txt .
|
||
RUN pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ \
|
||
--trusted-host mirrors.aliyun.com && \
|
||
pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ \
|
||
--trusted-host mirrors.aliyun.com \
|
||
-r requirements.txt \
|
||
&& rm -rf /root/.cache/pip
|
||
|
||
COPY . .
|
||
|
||
# 将workers数量从5改为1,解决WebSocket连接在多进程间不共享的问题
|
||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"] |