FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 # 1. Install system tools RUN apt-get update && apt-get install -y \ python3.10 python3-pip git \ libvulkan1 xdg-user-dirs unzip \ && rm -rf /var/lib/apt/lists/* # Upgrade pip # RUN pip3 install --upgrade pip setuptools wheel # Lock setuptools to v65.5.0 to fix the famous OpenAI Gym build crash! RUN pip3 install --upgrade pip wheel==0.38.4 && pip3 install setuptools==65.5.0 # 2. CREATE A NON-ROOT USER (Required by Unreal Engine!) # We create a user named 'user', make the /app folder, and give them ownership RUN useradd -m -u 1000 user RUN mkdir -p /app && chown -R user:user /app # Switch to the new non-admin user USER user # Ensure Python installs tools to the new user's specific path ENV PATH="/home/user/.local/bin:${PATH}" WORKDIR /app # 3. MANUALLY INSTALL SCHOLA RUN git clone https://github.com/GPUOpen-LibrariesAndSDKs/Schola.git /tmp/schola \ && cd /tmp/schola/Resources/python \ && pip3 install --user -e . # 4. INSTALL YOUR APP COPY --chown=user:user requirements.txt . # Downgrade pip to <24.1 to ignore the Gym typo, along with the PEP-517 fixes RUN pip3 install --user --no-cache-dir "pip<24.1" setuptools==65.5.0 wheel==0.38.4 RUN pip3 install --user --no-cache-dir gym==0.21.0 --no-build-isolation # Now install the rest of your requirements RUN pip3 install --user --no-cache-dir -r requirements.txt COPY --chown=user:user . . # Unpack Unreal Engine RUN unzip LinuxBuild.zip -d /app/GameData && rm LinuxBuild.zip RUN chmod +x /app/GameData/Linux/AIEnemyFightEnv.sh EXPOSE 7860 CMD ["bash", "start.sh"]