FROM python:3.11 WORKDIR /code # Copy requirements file first for better caching COPY requirements.txt /code/requirements.txt # Install dependencies RUN pip install --no-cache-dir -r /code/requirements.txt # Copy application code COPY app /code/app # Set proper permissions for app files RUN chmod -R 755 /code/app # Create directories for matplotlib to use RUN mkdir -p /tmp/matplotlib && chmod 777 /tmp/matplotlib # Ensure models directory exists and has proper permissions RUN mkdir -p /code/app/models && chmod 755 /code/app/models # Expose the port EXPOSE 7860 # Run the application CMD ["uvicorn", "app.server:app", "--host", "0.0.0.0", "--port", "7860"]