Spaces:
Sleeping
Sleeping
File size: 1,015 Bytes
91b7444 8f92a1d 91b7444 3dde541 91b7444 a8443c4 91b7444 380d86d 59ade7c 380d86d 91b7444 a8443c4 91b7444 a8443c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# Base image with Python 3.9
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV TORCH_HOME=/app/.cache
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Create necessary directories and set permissions
RUN mkdir -p /app/.cache && chmod -R 777 /app
# Copy requirements.txt into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Downgrade NumPy for compatibility
RUN pip install "numpy<2.0"
# Copy the application code
COPY . .
# Set permissions for all files and directories in /app
RUN chmod -R 777 /app
# Expose the port for the FastAPI application
EXPOSE 7860
# Command to run the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|