FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu18.04

ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display

# if you download resource slowly, you can edit '/etc/apt/sources.list' to add mirror source. 
COPY . /usr/share/minervas/

RUN apt-get update 
RUN apt-get install -y python3 gcc libassimp-dev python3-pip xvfb


RUN apt-get install -y -qq --no-install-recommends \
    libglvnd0 \
    libgl1 \
    libglx0 \
    libegl1 \
    libxext6 \
    libx11-6 \
  && rm -rf /var/lib/apt/lists/*

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute

RUN pip3 install pip -U

RUN    pip3 install scipy \
    && pip3 install -r /usr/share/minervas/ecs/requirements.txt \
    && pip3 install transformations==2020.1.1 \
    && pip3 install PyGLM \
    && pip3 install opencv-python


RUN pip3 install flask

RUN mkdir -p /usr/share/minervas/log \ 
    && mkdir -p /usr/share/minervas/output \
    && mkdir -p /usr/share/minervas/renderoutput \
    && mkdir -p /usr/share/minervas/pixeloutput 

ENV PYTHONPATH=/usr/share/minervas/ecs/

ENTRYPOINT ["/bin/bash","/usr/share/minervas/run-app.sh"]
