diff --git a/Dockerfile b/Dockerfile index 64a7f02..305f4f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,36 @@ ARG TARGETPLATFORM -FROM xdash-alt-base-image +FROM rokadias/python-opencv:main WORKDIR /xbot/Alt -RUN mkdir src +RUN apt-get update -yqq && \ + apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + xz-utils tk-dev libffi-dev liblzma-dev libhdf5-dev \ + python3-numpy python3-distutils \ + python3-setuptools python3-pyqt5 python3-opencv python3-zeroconf \ + libboost-python-dev libboost-thread-dev libatlas-base-dev libavcodec-dev \ + libavformat-dev libavutil-dev libcanberra-gtk3-module libeigen3-dev \ + libglew-dev libgl1-mesa-dev libgl1-mesa-glx libglib2.0-0 libgtk2.0-dev \ + libgtk-3-dev libjpeg-dev liblapack-dev \ + liblapacke-dev libopenblas-dev libopencv-dev libpng-dev libpostproc-dev \ + libpq-dev libsm6 libswscale-dev libtbb-dev libtesseract-dev \ + libtiff-dev libtiff5-dev libv4l-dev libx11-dev libxext6 libxine2-dev \ + libxrender-dev libxvidcore-dev libx264-dev libgtkglext1 libgtkglext1-dev \ + libvtk9-dev libdc1394-dev libgstreamer-plugins-base1.0-dev \ + libgstreamer1.0-dev libopenexr-dev \ + openexr \ + qv4l2 \ + v4l-utils \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean -RUN pip install --prefer-binary XTablesClient +COPY ./requirements.txt . + +# Install Python packages globally from requirements.txt +RUN pip install -r ./requirements.txt +RUN pip install XTablesClient==5.2.4 COPY ./src ./src diff --git a/docker-compose.yml b/docker-compose.yml index 83882ea..906baf8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ -version: "3.9" services: my-service: - image: xdash-docker-image + image: xdash-alt-image container_name: orange-pi-alt-container hostname: ${HOSTNAME} # Uses the current hostname of the system privileged: true # Equivalent to --privileged flag diff --git a/requirements.txt b/requirements.txt index 44b9f22..82b7692 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,17 @@ absl-py==2.1.0 alt==0.0.1 astunparse==1.6.3 -certifi>=2024.7.4 +certifi==2024.8.30 cffi==1.17.0 cfgv==3.4.0 -charset-normalizer>=3.3.2 +charset-normalizer==3.4.0 click==8.1.7 cloudpickle==3.0.0 colorama==0.4.6 contourpy==1.2.1 cryptography==43.0.0 cycler==0.12.1 -deep_sort @ git+https://github.com/team488/deep_sort@79af029bb17ce867f88c5f96564c3a9824afbdcb +deep-sort @ git+https://github.com/team488/deep_sort@79af029bb17ce867f88c5f96564c3a9824afbdcb distlib==0.3.8 ecdsa==0.19.0 exceptiongroup==1.2.2 @@ -25,8 +25,8 @@ google-pasta==0.2.0 gorilla==0.4.0 grpcio==1.66.1 identify==2.6.1 -idna>=3.7 -importlib_metadata>=8.2.0 +idna==3.10 +importlib_metadata==8.5.0 importlib_resources==6.4.5 iniconfig==2.0.0 Jinja2==3.1.4 @@ -55,7 +55,7 @@ pillow==10.4.0 platformdirs==4.3.6 pluggy==1.5.0 pre-commit==3.8.0 -psutil>=6.0.0 +psutil==6.1.0 py-cpuinfo==9.0.0 pyasn1==0.6.0 pycparser==2.22 @@ -69,7 +69,7 @@ PyYAML==6.0.2 requests==2.32.3 requests-futures==1.0.1 requests-toolbelt==1.0.0 -rich>=13.8.1 +rich==13.9.2 rsa==4.9 scipy==1.13.0 seaborn==0.13.2 @@ -84,10 +84,11 @@ typing_extensions==4.12.2 tzdata==2024.1 ultralytics==8.2.32 ultralytics-thop==2.0.8 -urllib3>=2.2.2 +urllib3==2.2.3 virtualenv==20.26.5 Werkzeug==3.0.4 wrapt==1.16.0 zipp>=3.20.0 +XTablesClient pycapnp pytesseract diff --git a/update_py_requirements.sh b/update_py_requirements.sh new file mode 100755 index 0000000..e40ffe8 --- /dev/null +++ b/update_py_requirements.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +set -e + +# This script assumes you have edited the `requirements.txt` +# file in the current directory with a new dependency. +# It will create a new python environment and then it will +# do a fresh install with all transitive dependencies, freezing +# the resulting packages and overwrriting `requirements.txt` +print_usage() { + echo "Usage: $0 /path/to/requirements.txt [optional python version] [optional venv name]" +} + +echo $1 + +if [ -n "$1" ] && [ -f "$1" ]; then + requirements_path="$1" + echo "Using requirements.txt-like file from $requirements_path" +else + echo "Path to requirements.txt file was not provided or file does not exist" + print_usage + exit 1 +fi + +if [ -n "$2" ]; then + python_version="$2" +else + python_version='3.9.19' +fi +if [ -n "$3" ]; then + venv_name="$3" +else + venv_name=$(mktemp -d tmp-${python_version}-$RANDOM-XXXX) +fi + +export PYTHON_VERSION="${python_version}" + +pyenv virtualenv "${python_version}" "${venv_name}" + +echo "Created temporary virtualenv '${venv_name}' (${python_version})." + +echo "Activating environment '${venv_name}'" +. "${PYENV_ROOT}/versions/${venv_name}/bin/activate" + +perl -p -i -e 'm/^## The following requirements were added by pip freeze:/ and exit' "$requirements_path" +# Wheel is used to install other packages from requirements.txt +# So we install is first, before everything else. +pip install wheel==0.41.1 +pip install -r "$requirements_path" +pip freeze -r "$requirements_path" > requirements-new.txt +mv requirements-new.txt "$requirements_path" + +echo "Destroying temporary virtualenv '${venv_name}'." +pyenv virtualenv-delete -f "${venv_name}" +# It seems to leave an empty directory behind, so we'll remove that too +rmdir "${venv_name}" + +echo Requirements file "$requirements_path" updated.