FROM python:3.11-slim AS app ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PYTHONPATH=/app/src \ FACEVERIFICATION_DEVICE=cpu WORKDIR /app RUN apt-get update && apt-get upgrade -y \ && apt-get install -y --no-install-recommends \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip setuptools "wheel>=0.46.2" RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt COPY pyproject.toml README.md ./ COPY src ./src RUN useradd --create-home --shell /usr/sbin/nologin appuser \ && mkdir -p /data/chroma \ && chown -R appuser:appuser /app /data USER appuser EXPOSE 8000 7860 FROM app AS fastapi CMD ["uvicorn", "faceverification.interfaces.fastapi_app:app", "--host", "0.0.0.0", "--port", "8000"] FROM app AS gradio ENV GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_SERVER_PORT=7860 CMD ["python", "-m", "faceverification.interfaces.gradio_app"]