# Pull python 3.7 docker image | |
FROM python:3.7 | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
# Create necessary directories | |
RUN mkdir -p /home/app/staticfiles/app/uploaded_videos/ | |
RUN mkdir -p /home/app/staticfiles/app/uploaded_images/ | |
WORKDIR /app | |
COPY . /app | |
# Install system dependencies for dlib | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
cmake \ | |
g++ \ | |
wget \ | |
unzip \ | |
libopenblas-dev \ | |
liblapack-dev \ | |
libx11-dev && \ | |
apt-get clean | |
# Install Rust and Cargo | |
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | |
ENV PATH="/root/.cargo/bin:$PATH" | |
# Install Python dependencies | |
RUN pip install --upgrade pip | |
RUN pip install opencv-python==4.2.0.32 | |
RUN pip install protobuf | |
# Install dlib from a precompiled wheel if available | |
RUN pip install dlib-19.24.99-cp37-cp37m-linux_x86_64.whl | |
# Install remaining Python packages | |
RUN pip install altair asgiref astor attrs backcall base58 bleach blinker cachetools certifi chardet click colorama cycler decorator defusedxml Django docutils entrypoints enum-compat face-recognition face-recognition-models future google google-api-core google-api-python-client google-auth google-auth-httplib2 googleapis-common-protos httplib2 idna ipykernel ipython ipython-genutils ipywidgets jedi Jinja2 jmespath json5 jsonschema jupyter-client jupyter-core jupyterlab jupyterlab-server kiwisolver MarkupSafe matplotlib mistune nbconvert nbformat notebook numpy packaging pandas pandocfilters parso pathtools pickleshare Pillow prometheus-client prompt-toolkit pyasn1 pyasn1-modules pycodestyle pydeck Pygments pyparsing pyrsistent python-dateutil pytz pywinpty PyYAML pyzmq requests rsa s3transfer Send2Trash six soupsieve sqlparse terminado testpath toml toolz torch torchvision tornado traitlets tzlocal uritemplate urllib3 validators watchdog wcwidth webencodings widgetsnbextension | |
RUN chmod +x /app/bin/gunicorn_start.sh | |
# Copy application files | |
RUN mkdir -p /app/staticfiles /app/uploaded_videos /app/uploaded_images | |
RUN python manage.py collectstatic --noinput | |
RUN pip install gunicorn | |
# Expose volume and set entry point | |
VOLUME /app/run/ | |
ENTRYPOINT ["/app/bin/gunicorn_start.sh"] | |