Spaces:
Runtime error
Runtime error
# Use an official Python runtime as a parent image | |
FROM python:3.9-slim | |
# Disable Python buffering for easier container logging | |
ENV PYTHONUNBUFFERED=1 | |
# Set environment variables for writable caches and config directories | |
ENV HOME=/tmp | |
ENV XDG_CACHE_HOME=/tmp/.cache | |
ENV MPLCONFIGDIR=/tmp/matplotlib | |
ENV HF_HOME=/tmp/hf_home | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies (ffmpeg is needed for video processing, libsm6/libxext6 support image/video) | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ffmpeg \ | |
libsm6 \ | |
libxext6 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy the requirements file into the container | |
COPY requirements.txt /app/requirements.txt | |
# Upgrade pip and install Python dependencies | |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
# Download spaCy's small English model | |
RUN python -m spacy download en_core_web_sm | |
# Create required directories with proper permissions | |
RUN mkdir -p /app/static /app/temp && chmod -R 777 /app/static /app/temp | |
# Copy the rest of your application code into the container | |
COPY . /app | |
# Expose the port your app runs on | |
EXPOSE 8500 | |
# Run the FastAPI application using uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8500"] | |