content: ##################################################
  # Created from template gz.dockerfile.jinja
  ##################################################
  
  ###########################################
  # Base image
  ###########################################
  FROM nvidia/cuda:12.5.0-runtime-ubuntu20.04 AS base
  
  # Avoid warnings by switching to noninteractive
  ENV DEBIAN_FRONTEND=noninteractive
  
  # Install language
  RUN apt-get update && apt-get install -y --no-install-recommends \
    locales \
    && locale-gen en_US.UTF-8 \
    && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
    && rm -rf /var/lib/apt/lists/*
  ENV LANG=en_US.UTF-8
  
  # Install timezone
  RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
    && export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install -y --no-install-recommends tzdata \
    && dpkg-reconfigure --frontend noninteractive tzdata \
    && rm -rf /var/lib/apt/lists/*
  
  # install packages
  RUN apt-get update && apt-get install -q -y \
      curl \
      gnupg \
      lsb-release \
      python3-argcomplete \
      sudo \
      wget \
    && wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
    && apt-get update && apt-get install -y -q \
      gz-garden \
    && rm -rf /var/lib/apt/lists/*
  
  ################
  # Expose the nvidia driver to allow opengl
  # Dependencies for glvnd and X11.
  ################
  RUN apt-get update \
   && apt-get install -y -qq --no-install-recommends \
    libglvnd0 \
    libgl1 \
    libglx0 \
    libegl1 \
    libxext6 \
    libx11-6
  
  # Env vars for the nvidia-container-runtime.
  ENV NVIDIA_VISIBLE_DEVICES=all
  ENV NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute
  ENV QT_X11_NO_MITSHM=1
  
  ARG USERNAME=ros
  ARG USER_UID=1000
  ARG USER_GID=$USER_UID
  
  # Check if "ubuntu" user exists, delete it if it does, then create the desired user
  RUN if getent passwd ubuntu > /dev/null 2>&1; then \
          userdel -r ubuntu && \
          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 user
  RUN apt-get update && apt-get install -y sudo \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    && rm -rf /var/lib/apt/lists/*
  
  # Set up autocompletion for user
  RUN apt-get update && apt-get install -y --no-install-recommends git-core bash-completion \
    && echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc \
    && echo "if [ -f /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash ]; then source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash; fi" >> /home/$USERNAME/.bashrc \
    && rm -rf /var/lib/apt/lists/*
  
  ###########################################
  # Develop image
  ###########################################
  FROM base AS dev
  
  ENV DEBIAN_FRONTEND=noninteractive
  # Install dev tools
  RUN apt-get update && apt-get install -y \
    python3-pip \
    wget \
    lsb-release \
    gnupg \
    curl \
    && sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros2-latest.list' \
    && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \
    && sudo apt-get update \
    && sudo apt-get install -y python3-vcstool python3-colcon-common-extensions \
    git \
    vim \
    && rm -rf /var/lib/apt/lists/*
  
  WORKDIR /workspaces/gazebo/src
  # Get sources
  RUN wget https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/refs/heads/master/collection-garden.yaml \
    && vcs import < collection-garden.yaml \
    # Get dependencies
    && sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
    && sudo apt-get update \
    && sudo apt -y install \
        $(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt' | grep -v '/\.git/') | sed '/gz\|sdf/d' | tr '\n' ' ')
  
  ENV DEBIAN_FRONTEND=
  