FROM python:3.12 # Set a working directory inside the container WORKDIR /app # Install required packages RUN pip install tensorflow==2.16.2 fastapi uvicorn requests pillow python-multipart # Ensure the application has a writable temp directory RUN mkdir -p /app/temp && chmod 777 /app/temp # Copy the FastAPI application code into the container COPY . . # Set environment variable for temporary files ENV TMP_DIR=/app/temp # Expose port for FastAPI EXPOSE 7860 # Run the FastAPI application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]