From 643447c3b2efed68019762f2508f0bdfae19a9b5 Mon Sep 17 00:00:00 2001 From: joumaaAli Date: Tue, 29 Oct 2024 10:26:15 +0100 Subject: [PATCH] (Fix): added opencv requirements to docker and added versions to requirements.txt --- Dockerfile | 36 ++++++++++++++++++++++++------------ requirements.txt | 20 ++++++++++---------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d93a7e..fabd0ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,44 @@ -FROM tiangolo/uvicorn-gunicorn:python3.6 AS uvicorn-builder +FROM tiangolo/uvicorn-gunicorn:python3.9 AS uvicorn-builder FROM openvino/ubuntu18_runtime:2021.4 USER root -# Copy scripts form uvicorn-builder (this is the only purpose of the uvicorn-builder build stage) +# Log start of copying scripts COPY --from=uvicorn-builder /start.sh /start.sh COPY --from=uvicorn-builder /start-reload.sh /start-reload.sh # Update pip -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN python3 -m pip install --upgrade pip -# Install dependencies +# Install build tools and OpenCV dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + ninja-build \ + pkg-config \ + libgl1-mesa-glx \ + libglib2.0-0 + +# Log the installation of Python dependencies COPY requirements.txt requirements.txt RUN python3 -m pip install -U -r requirements.txt -# Configure webserver settings -ENV HOST 0.0.0.0 -ENV PORT 80 -ENV WORKERS_PER_CORE 1 -ENV WEB_CONCURRENCY 1 -ENV LOG_LEVEL debug +ENV HOST=0.0.0.0 +ENV PORT=80 +ENV WORKERS_PER_CORE=1 +ENV WEB_CONCURRENCY=1 +ENV LOG_LEVEL=debug +ENV ACCESS_LOG=True +ENV ERROR_LOG=True EXPOSE 80 +# Log the copying of application files COPY src/main /app WORKDIR /app -# Setup OpenVINO environment vars before starting +# Setup OpenVINO and start the app CMD source /opt/intel/openvino/bin/setupvars.sh && \ - /start.sh \ No newline at end of file + echo "OpenVINO environment setup completed." && \ + /start.sh --log-level debug --access-log diff --git a/requirements.txt b/requirements.txt index c2c00bb..25c0492 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ -aiofiles -celery -fastapi -numpy -opencv-python>=4.0.0.0 -python-multipart -Pillow -python-socketio -requests +aiofiles==0.8.0 +celery==5.1.2 # Updated to a valid version +fastapi==0.83.0 +numpy== 1.19.5 +opencv-python>=4.10.0.84 +python-multipart==0.0.5 +Pillow==8.4.0 +python-socketio==5.11.0 +requests==2.27.1 uvicorn==0.11.5 gunicorn==20.0.4 -jsonschema \ No newline at end of file +jsonschema==4.0.0