Complete Flask → FastAPI migration with: - FastAPI app with session auth, Azure AD SSO, rate limiting - SQLite-backed session store (survives restarts) - Bulk AI metadata generation with SSE progress - Admin panel (user management, audit log, AI usage) - Subpath deployment support (ROOT_PATH config) - Docker + deploy.sh for production deployment - Test suite (auth, upload, templates, imports, admin, sessions) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.6 KiB
Docker
64 lines
1.6 KiB
Docker
# Oliver Metadata Tool - Docker Image
|
|
# Multi-stage build for optimized image size
|
|
|
|
FROM python:3.11-slim as base
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
# ExifTool - critical for metadata operations (300+ formats)
|
|
libimage-exiftool-perl \
|
|
# Tesseract OCR with CJK language support
|
|
tesseract-ocr \
|
|
tesseract-ocr-eng \
|
|
tesseract-ocr-chi-sim \
|
|
tesseract-ocr-chi-tra \
|
|
tesseract-ocr-jpn \
|
|
tesseract-ocr-kor \
|
|
# Poppler for PDF to image conversion
|
|
poppler-utils \
|
|
# FFmpeg for video processing
|
|
ffmpeg \
|
|
# curl for health check
|
|
curl \
|
|
# Build dependencies
|
|
gcc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Verify ExifTool installation
|
|
RUN exiftool -ver
|
|
|
|
# Copy requirements first for better layer caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /app/uploads /app/output /app/data /app/templates_saved
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV DOCKER_MODE=true
|
|
|
|
# Expose port
|
|
EXPOSE 5001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -sf http://localhost:5001/login || exit 1
|
|
|
|
# Run application with gunicorn + uvicorn workers
|
|
CMD ["gunicorn", "app.main:app", \
|
|
"--worker-class", "uvicorn.workers.UvicornWorker", \
|
|
"--workers", "2", \
|
|
"--bind", "0.0.0.0:5001", \
|
|
"--timeout", "120", \
|
|
"--graceful-timeout", "30", \
|
|
"--access-logfile", "-", \
|
|
"--error-logfile", "-"]
|