39 lines
928 B
Docker
39 lines
928 B
Docker
# 基于现有基础镜像
|
||
FROM ubuntu:22.04 AS asr-monitor-base
|
||
USER root
|
||
SHELL ["/bin/bash", "-c"]
|
||
|
||
# 安装系统依赖
|
||
RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked \
|
||
apt update && apt-get install -y \
|
||
libsndfile1 ffmpeg python3-pip \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
# 2. 验证 pip3 安装
|
||
RUN pip3 --version
|
||
|
||
ENV PYTHONPATH=/app/app
|
||
|
||
# 设置Python镜像源
|
||
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 安装Python依赖
|
||
|
||
|
||
|
||
# 设置工作目录
|
||
WORKDIR /app
|
||
# 关键:让Python将/app视为根目录
|
||
ENV PYTHONPATH=/app
|
||
|
||
# 修正后
|
||
COPY requirements.txt /tmp/requirements.txt
|
||
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
|
||
COPY app ./app
|
||
|
||
# 暴露端口
|
||
EXPOSE 9580
|
||
|
||
# 启动命令
|
||
#CMD ["python3", "-m", "app.main"]
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "9580"]
|