osmesa/Dockerfile

21 lines
971 B
Docker

FROM debian:bookworm
RUN rm /etc/apt/sources.list.d/debian.sources
RUN echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list
RUN echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list
RUN apt update
RUN apt install -y python3-full python3-opengl libosmesa6
# 创建虚拟python环境, 要用pip安装依赖, py3之后, 要求在虚拟环境中才能使用pip
RUN mkdir /opt/py
RUN python3 -m venv /opt/py
RUN /opt/py/bin/pip install numpy trimesh pyglet pyrender matplotlib
# 要升级pyopengl到3.1.4或以上
# 否则会报错 ImportError: cannot import name 'OSMesaCreateContextAttribs' from 'OpenGL.osmesa'
RUN /opt/py/bin/pip install --upgrade pyopengl
ENV PYOPENGL_PLATFORM=osmesa
Python 87.6%
Dockerfile 12.4%