Features: - Docker mode detection via DOCKER_MODE env var - Persistent volumes for uploads, database, and output - Health checks and auto-restart - Complete docker-compose.yml configuration - Helper script (docker-run.sh) for easy management - Comprehensive DOCKER.md documentation Changes: - web_app.py: Auto-detect Docker mode, use persistent dirs - src/database.py: Auto-detect database path based on environment - Dockerfile: Multi-stage build with all dependencies (ExifTool, Tesseract, Poppler, FFmpeg) - docker-compose.yml: Production-ready configuration - docker-run.sh: Management script (build, start, stop, logs, etc.) - DOCKER.md: Complete deployment and troubleshooting guide - README.md: Added Docker quick start section - .gitignore: Added Docker-related entries Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
56 lines
1.4 KiB
Docker
56 lines
1.4 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 (optional)
|
|
ffmpeg \
|
|
# 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
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV DOCKER_MODE=true
|
|
ENV FLASK_APP=web_app.py
|
|
|
|
# Expose port
|
|
EXPOSE 5001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD python -c "import requests; requests.get('http://localhost:5001/login', timeout=5)" || exit 1
|
|
|
|
# Run application
|
|
CMD ["python", "web_app.py"]
|