FROMubuntu:24.04# Set environment variablesENVDEBIAN_FRONTEND=noninteractive
ENVPYTHONUNBUFFERED=1ENVPYTHONDONTWRITEBYTECODE=1# Install system dependenciesRUNapt-getupdate&&apt-getinstall-y\build-essential\cmake\python3\python3-pip\git\curl\wget\vim\sudo\&&rm-rf/var/lib/apt/lists/*
# Create a non-root userARGUSERNAME=user
ARGUSER_UID=1000ARGUSER_GID=$USER_UID# Check if "ubuntu" user exists, delete it if it does, then create the desired userRUNifgetentpasswdubuntu>/dev/null2>&1;then\userdel-rubuntu&&\echo"Deleted existing ubuntu user";\fi&&\groupadd--gid$USER_GID$USERNAME&&\useradd-s/bin/bash--uid$USER_UID--gid$USER_GID-m$USERNAME&&\echo"Created new user $USERNAME"# Add sudo support for the non-root userRUNapt-getupdate&&apt-getinstall-ysudo\&&echo$USERNAMEALL=\(root\)NOPASSWD:ALL>/etc/sudoers.d/$USERNAME\&&chmod0440/etc/sudoers.d/$USERNAME\&&rm-rf/var/lib/apt/lists/*
# Install Python packages commonly used with PyBulletRUNapt-getupdate&&apt-getinstall-y--no-install-recommends\python3\python3-venv\&&rm-rf/var/lib/apt/lists/*
# 2. Create isolated environmentRUNapt-getupdate&&apt-getinstall-y--no-install-recommends\mesa-utils\&&rm-rf/var/lib/apt/lists/*
COPYrequirements.txt/tmp/requirements.txt
RUNpipinstall--break-system-packages--no-cache-dir-r/tmp/requirements.txt
RUNapt-getupdate&&apt-getinstall-y\mesa-utils\libgl1\libglvnd0\libglx-mesa0\libglu1-mesa\libx11-6\libxext6\&&rm-rf/var/lib/apt/lists/*
services:dev:build:context:.dockerfile:.devcontainer/Dockerfileuser:"user"volumes:-./:/workspace:cached-/tmp/.X11-unix:/tmp/.X11-unix:rwenvironment:-DISPLAY=${DISPLAY}-QT_X11_NO_MITSHM=1-NVIDIA_VISIBLE_DEVICES=all-NVIDIA_DRIVER_CAPABILITIES=all-__NV_PRIME_RENDER_OFFLOAD=1-__GLX_VENDOR_LIBRARY_NAME=nvidiaruntime:nvidianetwork_mode:hoststdin_open:truetty:truehostname:devextra_hosts:-"dev:127.0.0.1"deploy:resources:reservations:devices:-driver:nvidia# explicitly use NVIDIA runtimecount:allcapabilities:[gpu]