Files
Audio-Classifier/backend/Dockerfile.base
Benoit 6a55de3299
All checks were successful
Build Base Docker Image / Build Base Image (push) Successful in 16m30s
Build and Push Docker Images / Build Backend Image (push) Successful in 15m34s
Build and Push Docker Images / Build Frontend Image (push) Successful in 5m51s
Perf: Optimiser builds backend avec image de base (90-95% plus rapide)
Architecture en 2 images:
- Image base (audio-classifier-base): deps système + Python (~15min, 1x/semaine)
- Image app (audio-classifier-backend): code uniquement (~30s-2min, chaque commit)

Fichiers ajoutés:
- backend/Dockerfile.base: Image de base avec toutes les dépendances
- .gitea/workflows/docker-base.yml: CI pour build de l'image de base
- backend/DOCKER_BUILD.md: Documentation complète

Fichiers modifiés:
- backend/Dockerfile: Utilise l'image de base (FROM audio-classifier-base)
- .gitea/workflows/docker.yml: Passe BASE_IMAGE en build-arg

Gains de performance:
- Build normal: 15-25min → 30s-2min (90-95% plus rapide)
- Trigger auto du build base: quand requirements.txt change
- Trigger manuel: via interface Gitea Actions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-26 22:04:13 +01:00

60 lines
1.7 KiB
Docker

# 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