From fa3055f280ca56ce4563108a85e6ca6e121310c5 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 10 Jan 2022 11:43:18 -0800 Subject: [PATCH] smaller docker image (#23469) * save 2gb * not used * more cleanup * little more * wget too big * follow * needed for sim --- Dockerfile.openpilot_base | 16 +++++++++++----- tools/sim/Dockerfile.sim | 2 +- tools/ubuntu_setup.sh | 12 +----------- tools/webcam/Dockerfile | 4 ++-- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Dockerfile.openpilot_base b/Dockerfile.openpilot_base index 9229fb176..2ea26b854 100644 --- a/Dockerfile.openpilot_base +++ b/Dockerfile.openpilot_base @@ -13,14 +13,20 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 ENV PIPENV_SYSTEM=1 +ENV PYENV_VERSION=3.8.10 +ENV PYENV_ROOT="/root/.pyenv" +ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" + COPY Pipfile Pipfile.lock .python-version update_requirements.sh /tmp/ COPY tools/ubuntu_setup.sh /tmp/tools/ RUN cd /tmp && \ tools/ubuntu_setup.sh && \ - rm -rf /tmp/* && \ rm -rf /var/lib/apt/lists/* && \ - pip uninstall -y pipenv + rm -rf /tmp/* && \ + rm -rf /root/.cache && \ + pip uninstall -y pipenv && \ -ENV PYENV_VERSION=3.8.10 -ENV PYENV_ROOT="/root/.pyenv" -ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" + # remove unused architectures from gcc for panda + cd /usr/lib/gcc/arm-none-eabi/9.2.1 && \ + rm -rf arm/ && \ + rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp diff --git a/tools/sim/Dockerfile.sim b/tools/sim/Dockerfile.sim index f6cf0d9b0..4ffd5bea1 100644 --- a/tools/sim/Dockerfile.sim +++ b/tools/sim/Dockerfile.sim @@ -42,7 +42,7 @@ RUN pip install --upgrade pip && \ # get same tmux config used on NEOS for debugging RUN cd $HOME && \ - wget https://raw.githubusercontent.com/commaai/eon-neos-builder/master/devices/eon/home/.tmux.conf + curl -O https://raw.githubusercontent.com/commaai/eon-neos-builder/master/devices/eon/home/.tmux.conf ENV PYTHONPATH $HOME/openpilot:${PYTHONPATH} RUN mkdir -p $HOME/openpilot diff --git a/tools/ubuntu_setup.sh b/tools/ubuntu_setup.sh index 44ddb4f01..e688c79c1 100755 --- a/tools/ubuntu_setup.sh +++ b/tools/ubuntu_setup.sh @@ -13,12 +13,12 @@ function install_ubuntu_common_requirements() { sudo apt-get install -y --no-install-recommends \ autoconf \ build-essential \ + ca-certificates \ clang \ cmake \ make \ cppcheck \ libtool \ - libstdc++-arm-none-eabi-newlib \ gcc-arm-none-eabi \ bzip2 \ liblzma-dev \ @@ -28,7 +28,6 @@ function install_ubuntu_common_requirements() { libcapnp-dev \ curl \ libcurl4-openssl-dev \ - wget \ git \ git-lfs \ ffmpeg \ @@ -50,13 +49,6 @@ function install_ubuntu_common_requirements() { libsqlite3-dev \ libusb-1.0-0-dev \ libzmq3-dev \ - libsdl1.2-dev \ - libsdl-image1.2-dev \ - libsdl-mixer1.2-dev \ - libsdl-ttf2.0-dev \ - libsmpeg-dev \ - libportmidi-dev \ - libfreetype6-dev \ libsystemd-dev \ locales \ opencl-headers \ @@ -64,10 +56,8 @@ function install_ubuntu_common_requirements() { ocl-icd-opencl-dev \ clinfo \ python-dev \ - python3-pip \ qml-module-qtquick2 \ qtmultimedia5-dev \ - qtwebengine5-dev \ qtlocation5-dev \ qtpositioning5-dev \ libqt5sql5-sqlite \ diff --git a/tools/webcam/Dockerfile b/tools/webcam/Dockerfile index 7de86a4a7..70317cd92 100644 --- a/tools/webcam/Dockerfile +++ b/tools/webcam/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mkdir /tmp/opencv_build && \ cd /tmp/opencv_build && \ - wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \ + curl -L -O https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \ tar -xvf ${OPENCV_VERSION}.tar.gz && \ mv opencv-${OPENCV_VERSION} OpenCV && \ cd OpenCV && mkdir build && cd build && \ @@ -37,4 +37,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ make install && \ ldconfig && \ - cd /tmp && rm -rf /tmp/opencv_build + cd / && rm -rf /tmp/*