ai-api-testing / Dockerfile
Amitkasar's picture
Update Dockerfile for Hugging Face Spaces compatibility
ff7ddda
Raw History Blame Contribute Delete
999 Bytes
FROM python:3.11-slim
# Set up environment variables
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create a non-root user with UID 1000
RUN useradd -m -u 1000 user && chown -R user:user /app
# Switch to the non-root user
USER user
ENV PATH=/home/user/.local/bin:$PATH
# Install dependencies in user space
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy project files with user ownership
COPY --chown=user . .
# Create upload directories inside the app workspace
RUN mkdir -p backend/uploads/audio backend/uploads/video backend/uploads/documents backend/uploads/images backend/uploads/specs
EXPOSE 7860
CMD ["gunicorn", "backend.main:app", "-w", "2", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--timeout", "120"]