Dockerfile.openpilot_base 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. FROM ubuntu:20.04
  2. ENV PYTHONUNBUFFERED 1
  3. ENV DEBIAN_FRONTEND=noninteractive
  4. RUN apt-get update && \
  5. apt-get install -y --no-install-recommends sudo tzdata locales ssh pulseaudio xvfb x11-xserver-utils gnome-screenshot && \
  6. rm -rf /var/lib/apt/lists/*
  7. RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
  8. ENV LANG en_US.UTF-8
  9. ENV LANGUAGE en_US:en
  10. ENV LC_ALL en_US.UTF-8
  11. COPY tools/install_ubuntu_dependencies.sh /tmp/tools/
  12. RUN cd /tmp && \
  13. tools/install_ubuntu_dependencies.sh && \
  14. rm -rf /var/lib/apt/lists/* && \
  15. rm -rf /tmp/* && \
  16. # remove unused architectures from gcc for panda
  17. cd /usr/lib/gcc/arm-none-eabi/9.2.1 && \
  18. rm -rf arm/ && \
  19. rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp
  20. # Add OpenCL
  21. RUN apt-get update && apt-get install -y --no-install-recommends \
  22. apt-utils \
  23. alien \
  24. unzip \
  25. tar \
  26. curl \
  27. xz-utils \
  28. dbus \
  29. gcc-arm-none-eabi \
  30. tmux \
  31. vim \
  32. lsb-core \
  33. libx11-6 \
  34. && rm -rf /var/lib/apt/lists/*
  35. ARG INTEL_DRIVER=l_opencl_p_18.1.0.015.tgz
  36. ARG INTEL_DRIVER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532
  37. RUN mkdir -p /tmp/opencl-driver-intel
  38. RUN cd /tmp/opencl-driver-intel && \
  39. echo INTEL_DRIVER is $INTEL_DRIVER && \
  40. curl -O $INTEL_DRIVER_URL/$INTEL_DRIVER && \
  41. tar -xzf $INTEL_DRIVER && \
  42. for i in $(basename $INTEL_DRIVER .tgz)/rpm/*.rpm; do alien --to-deb $i; done && \
  43. dpkg -i *.deb && \
  44. rm -rf $INTEL_DRIVER $(basename $INTEL_DRIVER .tgz) *.deb && \
  45. mkdir -p /etc/OpenCL/vendors && \
  46. echo /opt/intel/opencl_compilers_and_libraries_18.1.0.015/linux/compiler/lib/intel64_lin/libintelocl.so > /etc/OpenCL/vendors/intel.icd && \
  47. cd / && \
  48. rm -rf /tmp/opencl-driver-intel
  49. ENV NVIDIA_VISIBLE_DEVICES all
  50. ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
  51. ENV QTWEBENGINE_DISABLE_SANDBOX 1
  52. RUN dbus-uuidgen > /etc/machine-id
  53. ARG USER=batman
  54. ARG USER_UID=1000
  55. RUN useradd -m -s /bin/bash -u $USER_UID $USER
  56. RUN usermod -aG sudo $USER
  57. RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
  58. USER $USER
  59. ENV POETRY_VIRTUALENVS_CREATE=false
  60. ENV PYENV_VERSION=3.11.4
  61. ENV PYENV_ROOT="/home/$USER/pyenv"
  62. ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
  63. COPY --chown=$USER pyproject.toml poetry.lock .python-version /tmp/
  64. COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/
  65. RUN cd /tmp && \
  66. tools/install_python_dependencies.sh && \
  67. rm -rf /tmp/* && \
  68. rm -rf /home/$USER/.cache && \
  69. find /home/$USER/pyenv -type d -name ".git" | xargs rm -rf && \
  70. rm -rf /home/$USER/pyenv/versions/3.11.4/lib/python3.11/test
  71. USER root
  72. RUN sudo git config --global --add safe.directory /tmp/openpilot