# Base image for Audio Classifier Backend # This image contains all system dependencies and Python packages # Build this image only when dependencies change (requirements.txt updates) # Use amd64 platform for better Essentia compatibility FROM --platform=linux/amd64 python:3.9-slim LABEL maintainer="benoit.schw@gmail.com" LABEL description="Base image with all dependencies for Audio Classifier Backend" # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ libsndfile1-dev \ gcc \ g++ \ gfortran \ libopenblas-dev \ liblapack-dev \ pkg-config \ curl \ build-essential \ libyaml-dev \ libfftw3-dev \ libavcodec-dev \ libavformat-dev \ libavutil-dev \ libswresample-dev \ libsamplerate0-dev \ libtag1-dev \ libchromaprint-dev \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Upgrade pip, setuptools, wheel RUN pip install --no-cache-dir --upgrade pip setuptools wheel # Copy requirements COPY requirements.txt . # Install Python dependencies in stages for better caching # Using versions compatible with Python 3.9 RUN pip install --no-cache-dir numpy==1.24.3 RUN pip install --no-cache-dir scipy==1.11.4 # Install Essentia-TensorFlow - Python 3.9 AMD64 support RUN pip install --no-cache-dir essentia-tensorflow # Install remaining dependencies RUN pip install --no-cache-dir -r requirements.txt # Verify installations RUN python -c "import essentia.standard; import numpy; import scipy; import fastapi; print('All dependencies installed successfully')" # This image is meant to be used as a base # The application code will be copied in the derived Dockerfile