✨ New Features: - Complete backup lifecycle management (create, list, download, delete, cleanup) - Web-based backup interface with real-time status updates - Individual backup deletion and bulk cleanup for old backups - Docker-aware backup operations with volume persistence - Automated backup scheduling and retention policies 📁 Added Files: - backup.py - Core backup script for creating timestamped archives - docker_backup.sh - Docker-compatible backup wrapper script - app/templates/backup.html - Web interface for backup management - BACKUP_SYSTEM.md - Comprehensive backup system documentation - BACKUP_GUIDE.md - Quick reference guide for backup operations 🔧 Enhanced Files: - Dockerfile - Added backup.py copy for container availability - docker-compose.yml - Added backup volume mount for persistence - app/routes/api.py - Added backup API endpoints (create, list, delete, cleanup) - app/routes/main.py - Added backup management route - app/templates/index.html - Added backup management navigation - README.md - Updated with backup system overview and quick start 🎯 Key Improvements: - Fixed backup creation errors in Docker environment - Added Docker-aware path detection for container operations - Implemented proper error handling and user confirmation dialogs - Added real-time backup status updates via JavaScript - Enhanced data persistence with volume mounting 💡 Use Cases: - Data protection and disaster recovery - Environment migration and cloning - Development data management - Automated maintenance workflows
53 lines
1.2 KiB
Docker
Executable File
53 lines
1.2 KiB
Docker
Executable File
# Use Python 3.11 slim image
|
|
FROM python:3.11-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gcc \
|
|
libjpeg-dev \
|
|
zlib1g-dev \
|
|
libfreetype6-dev \
|
|
liblcms2-dev \
|
|
libopenjp2-7-dev \
|
|
libtiff5-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY main.py .
|
|
COPY backup.py .
|
|
COPY gunicorn.conf.py .
|
|
COPY .env .
|
|
COPY app/ ./app/
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p app/static/qr_codes app/static/logos flask_session data
|
|
|
|
# Set environment variables
|
|
ENV FLASK_APP=main.py
|
|
ENV FLASK_ENV=production
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Create non-root user for security
|
|
RUN useradd --create-home --shell /bin/bash app && \
|
|
chown -R app:app /app
|
|
USER app
|
|
|
|
# Expose port
|
|
EXPOSE 5000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import requests; requests.get('http://localhost:5000/health')" || exit 1
|
|
|
|
# Run the application with Gunicorn for production
|
|
CMD ["gunicorn", "-c", "gunicorn.conf.py", "main:app"]
|