Spaces:
Running
Running
File size: 2,333 Bytes
9e4a797 7786e96 e65a8eb ef5b3bf 9e4a797 890829d ef5b3bf e65a8eb 9e4a797 e65a8eb 7786e96 b039445 7786e96 cf8ed1a 7786e96 b039445 7b8f950 7786e96 cf8ed1a 7b8f950 c9d7ff6 e2aea42 cf8ed1a e65a8eb c9d7ff6 d2b0c04 c9d7ff6 3b64741 35e2a0f ef5b3bf b5f1353 ef5b3bf e408c01 35e2a0f ef5b3bf 9e4a797 35e2a0f ef5b3bf e65a8eb 35e2a0f ef5b3bf 9e4a797 ef5b3bf 1a609a3 |
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 67 68 69 70 71 72 73 74 75 76 77 |
# Use an official Python runtime as a parent image
# This base image is Debian 12 "Bookworm"
FROM python:3.9-slim
# Set environment variables for Python and Numba
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
NUMBA_CACHE_DIR=/tmp/numba_cache
# Set the working directory
WORKDIR /app
# Install build dependencies and LLVM components from Debian's default repos (Bookworm)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libedit-dev \
libffi-dev \
python3-dev \
libgl1-mesa-glx \
libsm6 \
libxrender1 \
libglib2.0-0 \
ffmpeg \
libsndfile1 \
libsndfile1-dev \
# Install LLVM 14, which is common in Debian Bookworm
clang-14 \
llvm-14-dev \
llvm-14-runtime \
&& rm -rf /var/lib/apt/lists/*
# Set LLVM_CONFIG for clang-14 (needed by llvmlite)
ENV LLVM_CONFIG=/usr/bin/llvm-config-14
# --- CRITICAL CHANGE: Ensure correct NumPy version ---
# First, remove any pre-installed numpy that might conflict
RUN pip uninstall -y numpy || true
# Explicitly install the exact NumPy 1.x version
# This must come BEFORE numba and librosa to ensure they compile/install against it.
RUN pip install --no-cache-dir numpy==1.22.4
# Install llvmlite, numba, resampy, librosa which depend on numpy
RUN pip install --no-cache-dir \
llvmlite==0.36.0 \
numba==0.53.1 \
resampy==0.3.1 \
librosa==0.9.2
# Copy the requirements file into the container at /app
COPY requirements.txt /app/
# Install other Python dependencies from requirements.txt
# IT IS CRUCIAL that requirements.txt does NOT contain any numpy version that would conflict.
# If it does, you MUST remove or modify it.
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . /app/
# Create necessary directories
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 full permissions for app directory
RUN chmod -R 777 /app
# Expose the app port
EXPOSE 7860
# Set Flask environment variables
ENV FLASK_APP=app.py \
FLASK_ENV=production
# Start the application with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"] |