# 使用 Python 3.8.0 作为基础镜像 FROM python:3.8 # 设置工作目录 WORKDIR /app # 复制当前目录下的所有文件到工作目录 COPY . /app RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ # 安装依赖 RUN pip install --no-cache-dir -r requirements.txt RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list RUN apt-get update && apt-get install -y libgl1 # 暴露端口 EXPOSE 2002 # 运行应用程序 CMD ["python", "main.py"]