Dockerfile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Copyright (c) Contributors to the Open 3D Engine Project.
  2. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. #
  4. # SPDX-License-Identifier: Apache-2.0 OR MIT
  5. #
  6. # The cpu architecture
  7. ARG INPUT_ARCHITECTURE=amd64
  8. # The root docker image
  9. ARG INPUT_IMAGE=ubuntu
  10. # The root docker tag
  11. ARG INPUT_TAG=jammy
  12. # Pull in the base ubuntu docker
  13. FROM ${INPUT_ARCHITECTURE}/${INPUT_IMAGE}:${INPUT_TAG}
  14. ARG INPUT_IMAGE
  15. ARG INPUT_TAG
  16. ENV INPUT_IMAGE=$INPUT_IMAGE
  17. ENV WORKSPACE=/data/workspace
  18. WORKDIR $WORKSPACE
  19. # O3DE Arguments
  20. ARG O3DE_REPO=https://github.com/o3de/o3de
  21. ARG O3DE_BRANCH=development
  22. ARG O3DE_COMMIT=HEAD
  23. # O3DE Environment
  24. ENV O3DE_REPO=$O3DE_REPO
  25. ENV O3DE_BRANCH=$O3DE_BRANCH
  26. ENV O3DE_COMMIT=$O3DE_COMMIT
  27. ENV O3DE_ROOT=$WORKSPACE/o3de
  28. ENV LANG=en_US.UTF-8
  29. # Validate the tag if the image is 'ubuntu'
  30. RUN if [ "$INPUT_IMAGE" = "ubuntu" ]; then \
  31. if [ "$INPUT_TAG" != "jammy" ] && [ "$INPUT_TAG" != "nobel" ]; then \
  32. echo "ERROR: Unsupported ubuntu tag: ${INPUT_TAG}. Must be either 'jammy' or 'nobel'"; \
  33. exit 1;\
  34. fi \
  35. fi
  36. # Validate the tag if the image is 'ros'
  37. RUN if [ "$INPUT_IMAGE" = "ros" ]; then \
  38. if [ "$INPUT_TAG" != "humble" ] && [ "$INPUT_TAG" != "jazzy" ]; then \
  39. echo "ERROR: Unsupported ros tag: ${INPUT_TAG}. Must be either 'humble' or 'jazzy'"; \
  40. exit 1;\
  41. fi \
  42. fi
  43. # Setup time zone and locale data (necessary for SSL and HTTPS packages)
  44. RUN apt-get update \
  45. && DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata locales keyboard-configuration curl \
  46. && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
  47. && dpkg-reconfigure --frontend=noninteractive locales \
  48. && update-locale LANG=en_US.UTF-8 \
  49. && rm -rf /var/lib/apt/lists/*
  50. # Install the required ubuntu packages
  51. RUN apt-get update \
  52. && apt-get install -y \
  53. binutils \
  54. clang \
  55. cmake \
  56. cmake-qt-gui \
  57. git \
  58. git-lfs \
  59. libglu1-mesa-dev \
  60. libxcb-xinerama0 \
  61. libfontconfig1-dev \
  62. libnvidia-gl-470 \
  63. libxcb-xkb-dev \
  64. libxkbcommon-x11-dev \
  65. libxkbcommon-dev \
  66. libxcb-xfixes0-dev \
  67. libxcb-xinput-dev \
  68. libxcb-xinput0 \
  69. libxcb-icccm4-dev \
  70. libxcb-image0-dev \
  71. libxcb-keysyms1-dev \
  72. libxcb-render-util0-dev \
  73. libpcre2-16-0 \
  74. libunwind-dev \
  75. libzstd-dev \
  76. ninja-build \
  77. python3-pip \
  78. software-properties-common \
  79. mesa-common-dev \
  80. libvulkan1 \
  81. gedit \
  82. xdg-utils \
  83. desktop-file-utils \
  84. nautilus \
  85. sudo
  86. # If this is a 'ros' image, add additional ros packages that are used by the current ros project templates.
  87. RUN if [ "$INPUT_IMAGE" = "ros" ]; then \
  88. apt-get install -y ros-${ROS_DISTRO}-ackermann-msgs \
  89. ros-${ROS_DISTRO}-control-toolbox \
  90. ros-${ROS_DISTRO}-nav-msgs \
  91. ros-${ROS_DISTRO}-gazebo-msgs \
  92. ros-${ROS_DISTRO}-xacro \
  93. ros-${ROS_DISTRO}-moveit \
  94. ros-${ROS_DISTRO}-moveit-resources \
  95. ros-${ROS_DISTRO}-depth-image-proc; \
  96. fi
  97. # Setup the 'o3de' user for this image (with a default group id, which will be updated in the entrypoint)
  98. ENV O3DE_USER=o3de
  99. RUN addgroup --gid 1000 "$O3DE_USER" \
  100. && adduser --gid 1000 --gecos "" --disabled-password "$O3DE_USER" \
  101. && usermod -a -G sudo $O3DE_USER \
  102. && echo "$O3DE_USER ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/$O3DE_USER
  103. COPY build.sh $WORKSPACE/
  104. COPY entrypoint.sh $WORKSPACE/
  105. # Run the script to clone, build, and install O3DE as an SDK installer
  106. RUN cd $WORKSPACE \
  107. && ./build.sh \
  108. && rm build.sh
  109. ENV NVIDIA_VISIBLE_DEVICES all
  110. ENV NVIDIA_DRIVER_CAPABILITIES all
  111. ENTRYPOINT ["/bin/bash", "-c", "/data/workspace/entrypoint.sh"]