Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leanify dockerfile #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7eb1add
leanify dockerfile
JustinMiehle May 15, 2024
bbdc9f9
add chown=$USER to install scripts
JustinMiehle May 15, 2024
e9f0516
Fix premature copying of python script
JustinMiehle May 15, 2024
a28f6ba
attempt to make apt-get a bit less hungry
JustinMiehle May 15, 2024
cc7e040
Further attempts at apt-get
JustinMiehle May 15, 2024
d1ca87d
Bogus change to be reverted
JustinMiehle May 15, 2024
05422f4
Add buildarg for testing
JustinMiehle May 16, 2024
afc0038
fix mistake in passing build_arg
JustinMiehle May 16, 2024
53f1805
see if caching is in effect on my branch
JustinMiehle May 16, 2024
0196af9
Try out gha cache
JustinMiehle May 16, 2024
da36834
Fix typo in docker build command
JustinMiehle May 16, 2024
fd348c7
trigger empty to see if caching already works
JustinMiehle May 16, 2024
88ce56d
this did not work - another try
JustinMiehle May 16, 2024
ba60993
try local caching
JustinMiehle May 16, 2024
df8ca4f
going strong with the typos
JustinMiehle May 16, 2024
cf01322
configuring buildx
JustinMiehle May 16, 2024
f7058d1
fix missing colon
JustinMiehle May 16, 2024
2a9d36b
more attempts
JustinMiehle May 16, 2024
8456861
fix template
JustinMiehle May 16, 2024
caeb6cd
forgot the line separator
JustinMiehle May 16, 2024
59e8e9d
remove misguided remove
JustinMiehle May 16, 2024
8176095
it was the ampersand
JustinMiehle May 16, 2024
2a970c8
Test if it works
JustinMiehle May 17, 2024
29600d7
mode=max is way too aggressive
JustinMiehle May 17, 2024
cd0cca7
another time
JustinMiehle May 17, 2024
2b6d768
Let us see if this flies
JustinMiehle May 17, 2024
5671808
revert layering changes
JustinMiehle May 21, 2024
bb52bad
Fix merge conflict and try to pull
JustinMiehle May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Dockerfile.openpilot_base
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM ubuntu:20.04
ENV PYTHONUNBUFFERED 1

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends sudo tzdata locales ssh pulseaudio xvfb x11-xserver-utils gnome-screenshot && \
rm -rf /var/lib/apt/lists/*
Expand All @@ -13,14 +14,15 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

COPY tools/install_ubuntu_dependencies.sh /tmp/tools/
RUN cd /tmp && \
tools/install_ubuntu_dependencies.sh && \
RUN INSTALL_EXTRA_PACKAGES=no tools/install_ubuntu_dependencies.sh && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /usr/share/vim/vim81/doc && \
rm -rf /usr/lib/python2.7 && \
# 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
rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp thumb/v7-m/nofp thumb/v7e-m/nofp thumb/v7/nofp

# Add OpenCL
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -36,7 +38,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
vim \
lsb-core \
libx11-6 \
&& rm -rf /var/lib/apt/lists/*
&& apt-get clean && apt-get autoremove && apt-get purge && rm -rf /var/lib/apt/lists/*

ARG INTEL_DRIVER=l_opencl_p_18.1.0.015.tgz
ARG INTEL_DRIVER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532
Expand All @@ -52,6 +54,7 @@ RUN cd /tmp/opencl-driver-intel && \
mkdir -p /etc/OpenCL/vendors && \
echo /opt/intel/opencl_compilers_and_libraries_18.1.0.015/linux/compiler/lib/intel64_lin/libintelocl.so > /etc/OpenCL/vendors/intel.icd && \
cd / && \
rm -rf /opt/intel/opencl_compilers_and_libraries_18.1.0.015/uninstall && \
rm -rf /tmp/opencl-driver-intel

ENV NVIDIA_VISIBLE_DEVICES all
Expand All @@ -78,6 +81,10 @@ COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/
RUN cd /tmp && \
tools/install_python_dependencies.sh && \
rm -rf /tmp/* && \
rm -rf /home/batman/pyenv/versions/3.11.4/lib/python3.11/site-packages/SCons/Tool/docbook && \
rm -rf /home/batman/pyenv/versions/3.11.4/lib/python3.11/site-packages/onnx/backend/test && \
rm -rf /home/batman/pyenv/versions/3.11.4/lib/python3.11/site-packages/pygame/docs && \
rm -rf /home/batman/pyenv/versions/3.11.4/lib/python3.11/site-packages/scipy/spatial/tests && \
rm -rf /home/$USER/.cache && \
find /home/$USER/pyenv -type d -name ".git" | xargs rm -rf && \
rm -rf /home/$USER/pyenv/versions/3.11.4/lib/python3.11/test
Expand Down
7 changes: 6 additions & 1 deletion selfdrive/test/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ fi

source $SCRIPT_DIR/docker_common.sh $1 "$TAG_SUFFIX"

DOCKER_BUILDKIT=1 docker buildx build --provenance false --pull --platform $PLATFORM --load --cache-to type=inline --cache-from type=registry,ref=$REMOTE_TAG -t $REMOTE_TAG -t $LOCAL_TAG -f $OPENPILOT_DIR/$DOCKER_FILE $OPENPILOT_DIR
if [ -n "$REBUILD_IMAGE" ]; then
DOCKER_BUILDKIT=1 docker buildx build --provenance false --pull --platform $PLATFORM --load --cache-to type=inline --cache-from type=registry,ref=$REMOTE_TAG -t $REMOTE_TAG -t $LOCAL_TAG -f $OPENPILOT_DIR/$DOCKER_FILE $OPENPILOT_DIR
else
docker pull --platform $PLATFORM $REMOTE_TAG
fi

if [ -n "$PUSH_IMAGE" ]; then

docker push $REMOTE_TAG
docker tag $REMOTE_TAG $REMOTE_SHA_TAG
docker push $REMOTE_SHA_TAG
Expand Down