content: ##################################################
  # Created from template ignition.dockerfile.jinja
  ##################################################
  
  ###########################################
  # Base image 
  ###########################################
  FROM ubuntu:18.04 AS base
  
  # Avoid warnings by switching to noninteractive
  ENV DEBIAN_FRONTEND=noninteractive
  
  # Install language
  RUN apt-get update && apt-get install -y \
    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 tzdata \
    && dpkg-reconfigure --frontend noninteractive tzdata \
    && rm -rf /var/lib/apt/lists/*
  
  # install packages
  RUN apt-get update && apt-get install -q -y \
    dirmngr \
    gnupg2 \
    lsb-release \
    wget \
    && sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' \
    && wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - \
    && apt-get update && apt-get install -y \
      ignition-blueprint \
    && 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 \
    libignition-plugin-dev \
    libignition-cmake2-dev \
    libignition-gazebo2-dev \
    git \
    vim \
    && rm -rf /var/lib/apt/lists/*
  
  ARG USERNAME=ros
  ARG USER_UID=1000
  ARG USER_GID=$USER_UID
  
  # Create a non-root user
  RUN groupadd --gid $USER_GID $USERNAME \
    && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
    # [Optional] Add sudo support for the non-root user
    && apt-get update \
    && apt-get install -y sudo \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    # Cleanup
    && rm -rf /var/lib/apt/lists/* \
    && echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc \
    && echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
  ENV DEBIAN_FRONTEND=
  
  ###########################################
  # Nvidia image 
  ###########################################
  FROM dev AS nvidia
  
  ################
  # 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