Spaces:
Running
Running
File size: 2,059 Bytes
9e4a797 e65a8eb 9e4a797 890829d e65a8eb 9e4a797 e65a8eb 9e4a797 a2e9365 c91e02c 9e4a797 c91e02c a2e9365 b5f1353 5008817 9e4a797 6c3a48d a2e9365 9e4a797 a2e9365 e65a8eb 3b64741 35e2a0f b5f1353 9e4a797 e408c01 35e2a0f f3e5d5a 9e4a797 35e2a0f f3e5d5a 14d7a99 9e4a797 e65a8eb 35e2a0f 9e4a797 |
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
NUMBA_DISABLE_JIT=1
# Set the working directory
WORKDIR /app
# Copy the requirements file into the container at /app
COPY requirements.txt /app/
# Install build dependencies for numba/llvmlite (LLVM and Clang), including specific dev libraries
# This uses the default available LLVM/Clang versions for Debian Bookworm
RUN apt-get update && \
apt-get install -y --no-install-recommends \
llvm \
clang \
build-essential \
libedit-dev \
libffi-dev \
python3-dev \
libgl1-mesa-glx \
libsm6 \
libxrender1 \
libglib2.0-0 \
ffmpeg \
&& \
rm -rf /var/lib/apt/lists/*
# Set LLVM_CONFIG environment variable *before* installing numba/llvmlite
# Use the version that apt-get install llvm provides (likely llvm-config-14 for Bookworm)
ENV LLVM_CONFIG=/usr/bin/llvm-config-14
# Install numpy first, as numba/llvmlite depend on it for building
# It's explicitly installed here to ensure it's available for numba's build process.
RUN pip install --no-cache-dir numpy==1.22.4
# Install the rest of the dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code to /app
COPY . /app/
# Create necessary directories with appropriate permissions
RUN mkdir -p /app/cache /app/uploads /app/results /app/checkpoints /app/temp \
&& chmod -R 777 /app/cache /app/uploads /app/results /app/checkpoints /app/temp
# Ensure all relevant directories have the correct permissions
RUN chmod -R 777 /app
# Disable Numba's on-disk caching (often problematic in containers)
ENV NUMBA_DISABLE_PER_FILE_CACHE=1
# Expose the port the app runs on
EXPOSE 7860
# Set environment variables for Flask
ENV FLASK_APP=app.py \
FLASK_ENV=production
# Command to run the application
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"] |