# Use a lightweight Python base image FROM python:3.8-slim-buster # Set the working directory WORKDIR /app # Create a directory for PyTorch cache with appropriate permissions RUN mkdir -p /app/.cache/torch && chmod 755 /app/.cache/torch # Set the environment variable for PyTorch cache ENV TORCH_HOME=/app/.cache/torch # Copy the requirements file and install dependencies COPY requirements.txt requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY . . # Expose the port for the application (adjust as needed) EXPOSE 8080 # Command to run the application (adjust as needed) CMD ["gunicorn", "-b", "0.0.0.0:8080", "app:app"]