# Use a Python 3.9 base image FROM python:3.9-slim # Set working directory WORKDIR /code # Copy requirements file COPY ./requirements.txt /code/requirements.txt # Install dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a non-root user for security RUN useradd -m -u 1000 user # Set up directories and permissions RUN mkdir -p /code/Data/Processed_Data && chown -R user:user /code USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set app directory WORKDIR /code # Copy all project files with correct ownership COPY --chown=user . /code # Expose port 7860 (Hugging Face default) EXPOSE 7860 # Run the FastAPI app with uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]