diff --git a/Dockerfile.headless b/Dockerfile.headless index c469356..f97e03f 100644 --- a/Dockerfile.headless +++ b/Dockerfile.headless @@ -1,46 +1,49 @@ -# Dockerfile -FROM debian:bookworm-slim -RUN apt-get -y update -RUN apt install libgl1-mesa-glx -y -RUN apt-get install 'ffmpeg'\ - 'libsm6'\ - 'libxext6' -y +# ============================ +# Base image +# ============================ +FROM python:3.11-slim-bookworm -# Headless part. -RUN apt-get update -y \ - && apt-get install --no-install-recommends -y xvfb libgl1-mesa-dri - +# Prevent interactive prompts during package installs +ENV DEBIAN_FRONTEND=noninteractive \ + PYTHONUNBUFFERED=1 \ + XVFB_RES="1920x1080x24" \ + XVFB_ARGS="" + +# Install system dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + ffmpeg \ + libgl1-mesa-glx \ + libsm6 \ + libxext6 \ + libgl1-mesa-dri \ + mesa-utils \ + xvfb && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# ============================ +# Headless setup +# ============================ WORKDIR /usr/bin COPY xvfb-startup.sh . - RUN sed -i 's/\r$//' xvfb-startup.sh -ARG RESOLUTION="1920x1080x24" -ENV XVFB_RES="${RESOLUTION}" -ARG XARGS="" -ENV XVFB_ARGS="${XARGS}" ENTRYPOINT ["/bin/bash", "xvfb-startup.sh"] -RUN apt-get update -y \ - && apt-get install --no-install-recommends -y mesa-utils - -# Rally part. +# ============================ +# Application setup +# ============================ WORKDIR /app -RUN apt-get update && apt-get install -y git && apt-get clean -# RUN git clone https://gitlab.hevs.ch/louis.lettry/rallyrobopilot.git . -# RUN git checkout cedric -COPY . . -RUN set -xe \ - && apt-get update \ - && apt-get install -y python3-pip \ - && apt-get install -y python3-venv +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt && \ + pip install --no-cache-dir python3_xlib && \ + pip install --no-cache-dir -e . -# Set env path. -ENV VIRTUAL_ENV=/opt/venv -RUN python3 -m venv $VIRTUAL_ENV -ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt -RUN pip install python3_xlib -RUN pip install -e . +COPY . . +# ============================ +# Default command +# ============================ CMD ["python", "scripts/main.py"] diff --git a/requirements.txt b/requirements.txt index 4262965..7b073d0 100755 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ ursinanetworking==2.1.4 imageio==2.35.1 numpy>=2.1.0 screeninfo==0.8.1 +PyQt6==6.7.1 Flask==3.0.3 psd-tools3==1.8.2 -setuptools +setuptools \ No newline at end of file