behring-bjj-face-api / Dockerfile
FelipeFavalli's picture
Update Dockerfile
4cef058 verified
Raw History Blame Contribute Delete
865 Bytes
FROM python:3.11
# Install system dependencies for OpenCV (OpenGL and glib)
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 user
# Set up environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY requirements.txt .
# Install dependencies as root
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Copy application files and change ownership to user
COPY --chown=user . $HOME/app
# Switch to the non-root user
USER user
# Pre-download the buffalo_s model to bake it into the Docker image for faster startup
RUN python -c "from insightface.app import FaceAnalysis; FaceAnalysis(name='buffalo_s', root='/home/user/.insightface').prepare(ctx_id=0)"
EXPOSE 7860
CMD ["python", "app.py"]