From 204a3a1ccc64ac8ccafd7bed0924d841fea3102c Mon Sep 17 00:00:00 2001 From: Loy van Beek Date: Thu, 19 Dec 2024 22:11:15 +0100 Subject: [PATCH] Add Docker file to run independent of host OS I got spooked by the --break-system-packages flag --- Dockerfile | 13 +++++++++++++ docker-compose.yml | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..447effb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:22.04 + +RUN /bin/bash -c "apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -yy -q python3-numpy python3-pygame python3-scipy python3-tqdm python3-pip python3-pandas\ + && rm -rf /var/lib/apt/lists/*" +RUN python3 -m pip install --user pygame_widgets + +RUN mkdir -p /root/coding-challenge-racer +WORKDIR /root/coding-challenge-racer + +COPY --link . . + +ENTRYPOINT [ "python3", "tournament.py", "Zandvoort"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d3794ad --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +services: + # Base image containing dependencies. + base: + image: racer + build: + context: . + dockerfile: Dockerfile + # Interactive shell + stdin_open: true + tty: true + # Networking and IPC for ROS 2 + network_mode: host + # Needed to display graphical applications + privileged: true + environment: + # Allows graphical programs in the container. + - DISPLAY=${DISPLAY} + - QT_X11_NO_MITSHM=1 + - NVIDIA_DRIVER_CAPABILITIES=all + volumes: + # Allows graphical programs in the container. + - /tmp/.X11-unix:/tmp/.X11-unix:rw + - ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority