updated requirements to be close to latest; up dated dockerfile

This commit is contained in:
chappie74 2023-12-05 16:44:48 -04:00
parent 6d33c1d8be
commit 4259cee934
2 changed files with 75 additions and 56 deletions

View File

@ -1,58 +1,75 @@
# base image FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
FROM python:3.8.12
LABEL org.opencontainers.image.source https://github.com/serengil/deepface
# ----------------------------------- RUN groupadd -r default && useradd -r -g default chappie
# create required folder
RUN mkdir /app
RUN mkdir /app/deepface
# ----------------------------------- ENV HOME=/home/chappie/app
# switch to application directory ENV LANG C.UTF-8
WORKDIR /app ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV TZ=Asia/Kolkata
ENV DEBIAN_FRONTEND=noninteractive
# -----------------------------------
# update image os WORKDIR $HOME
RUN apt-get update && apt-get install -y \
python3.11 python3-pip \
nano gunicorn git
RUN ln -s /usr/bin/python3 /usr/bin/python
# # -----------------------------------
# # create required folder
RUN mkdir $HOME/deepface
# # -----------------------------------
# # Copy required files from repo into image
COPY ./deepface $HOME/deepface
COPY ./api/app.py $HOME
COPY ./api/api.py $HOME
COPY ./api/routes.py $HOME
COPY ./api/service.py $HOME
COPY ./requirements.txt $HOME
COPY ./setup.py $HOME
COPY ./README.md $HOME
RUN python -m pip install --upgrade pip
# # update image os
RUN apt-get update RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y RUN apt-get install ffmpeg libsm6 libxext6 libgl1 -y
# -----------------------------------
# Copy required files from repo into image
COPY ./deepface /app/deepface
# even though we will use local requirements, this one is required to perform install deepface from source code
COPY ./requirements.txt /app/requirements.txt
COPY ./requirements_local /app/requirements_local.txt
COPY ./package_info.json /app/
COPY ./setup.py /app/
COPY ./README.md /app/
# ----------------------------------- # RUN chown -R chappie:default $HOME
# if you plan to use a GPU, you should install the 'tensorflow-gpu' package # USER chappie
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu
# # -----------------------------------
# # if you plan to use a GPU, you should install the 'tensorflow-gpu' package
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow
# # -----------------------------------
# # install deepface from pypi release (might be out-of-date)
# # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface
# # -----------------------------------
# # install deepface from source code (always up-to-date)
# if you plan to use face anti-spoofing, then activate this line
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org torch==2.1.2
# -----------------------------------
# install deepface from pypi release (might be out-of-date)
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface
# -----------------------------------
# install dependencies - deepface with these dependency versions is working
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -r /app/requirements_local.txt
# install deepface from source code (always up-to-date)
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e . RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e .
# ----------------------------------- # # -----------------------------------
# some packages are optional in deepface. activate if your task depends on one. # # some packages are optional in deepface. activate if your task depends on one.
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org cmake==3.24.1.1 # # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org cmake==3.24.1.1
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org dlib==19.20.0 # # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org dlib==19.20.0
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org lightgbm==2.3.1 # # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org lightgbm==2.3.1
# ----------------------------------- # # RUN pip cache purge && rm $(basename $TF_URL)
# environment variables
ENV PYTHONUNBUFFERED=1
# ----------------------------------- # # -----------------------------------
# run the app (re-configure port if necessary) # # run the app (re-configure port if necessary)
WORKDIR /app/deepface/api/src
EXPOSE 5000 EXPOSE 5000
CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"] CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]

View File

@ -1,15 +1,17 @@
requests>=2.27.1 numpy>=1.26.2
numpy>=1.14.0 pandas>=2.1.3
pandas>=0.23.4
gdown>=3.10.1 gdown>=3.10.1
tqdm>=4.30.0 tqdm>=4.30.0
Pillow>=5.2.0 Pillow==10.1.0
opencv-python>=4.5.5.64 opencv-python>=4.8.1.78
tensorflow>=1.9.0 tensorflow==2.14.0
keras>=2.2.0 keras==2.14.0
Flask>=1.1.2 Flask>=3.0.0
flask_cors>=4.0.1 mtcnn>=0.1.1
mtcnn>=0.1.0 retina-face>=0.0.13
retina-face>=0.0.1
fire>=0.4.0 fire>=0.4.0
gunicorn>=20.1.0 gunicorn>=20.1.0
Deprecated>=1.2.13
matplotlib~=3.8.2
requests~=2.31.0
setuptools~=68.0.0