Dockerfile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # base image
  2. FROM python:3.8.12
  3. LABEL org.opencontainers.image.source https://github.com/serengil/deepface
  4. # -----------------------------------
  5. # create required folder
  6. RUN mkdir /app
  7. RUN mkdir /app/deepface
  8. # -----------------------------------
  9. # switch to application directory
  10. WORKDIR /app
  11. # -----------------------------------
  12. # update image os
  13. # Install system dependencies
  14. RUN apt-get update && apt-get install -y \
  15. ffmpeg \
  16. libsm6 \
  17. libxext6 \
  18. libhdf5-dev \
  19. && rm -rf /var/lib/apt/lists/*
  20. # -----------------------------------
  21. # Copy required files from repo into image
  22. COPY ./deepface /app/deepface
  23. # even though we will use local requirements, this one is required to perform install deepface from source code
  24. COPY ./requirements.txt /app/requirements.txt
  25. COPY ./requirements_local /app/requirements_local.txt
  26. COPY ./package_info.json /app/
  27. COPY ./setup.py /app/
  28. COPY ./README.md /app/
  29. COPY ./entrypoint.sh /app/deepface/api/src/entrypoint.sh
  30. # -----------------------------------
  31. # if you plan to use a GPU, you should install the 'tensorflow-gpu' package
  32. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu
  33. # if you plan to use face anti-spoofing, then activate this line
  34. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org torch==2.1.2
  35. # -----------------------------------
  36. # install deepface from pypi release (might be out-of-date)
  37. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface
  38. # -----------------------------------
  39. # install dependencies - deepface with these dependency versions is working
  40. RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -r /app/requirements_local.txt
  41. # install deepface from source code (always up-to-date)
  42. RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e .
  43. # -----------------------------------
  44. # some packages are optional in deepface. activate if your task depends on one.
  45. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org cmake==3.24.1.1
  46. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org dlib==19.20.0
  47. # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org lightgbm==2.3.1
  48. # -----------------------------------
  49. # environment variables
  50. ENV PYTHONUNBUFFERED=1
  51. # -----------------------------------
  52. # run the app (re-configure port if necessary)
  53. WORKDIR /app/deepface/api/src
  54. EXPOSE 5000
  55. # CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]
  56. ENTRYPOINT [ "sh", "entrypoint.sh" ]