- Add HTTPSConfig model for managing HTTPS settings - Add admin routes for HTTPS configuration management - Add beautiful admin template for HTTPS configuration - Add database migration for https_config table - Add CLI utility for HTTPS management - Add setup script for automated configuration - Add Caddy configuration generator and manager - Add comprehensive documentation (3 guides) - Add HTTPS Configuration card to admin dashboard - Implement input validation and security features - Add admin-only access control with audit trail - Add real-time configuration preview - Integrate with existing Caddy reverse proxy Features: - Enable/disable HTTPS from web interface - Configure domain, hostname, IP address, port - Automatic SSL certificate management via Let's Encrypt - Real-time Caddyfile generation and reload - Full audit trail with admin username and timestamps - Support for HTTPS and HTTP fallback access points - Beautiful, mobile-responsive UI Modified files: - app/models/__init__.py (added HTTPSConfig import) - app/blueprints/admin.py (added HTTPS routes) - app/templates/admin/admin.html (added HTTPS card) - docker-compose.yml (added Caddyfile mount and admin port) New files: - app/models/https_config.py - app/blueprints/https_config.html - app/utils/caddy_manager.py - https_manager.py - setup_https.sh - migrations/add_https_config_table.py - migrations/add_email_to_https_config.py - HTTPS_STATUS.txt - Documentation files (3 markdown guides)
62 lines
1.8 KiB
Docker
Executable File
62 lines
1.8 KiB
Docker
Executable File
# Use Python 3.13 slim image
|
|
FROM python:3.13-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies including LibreOffice for PPTX conversion
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
poppler-utils \
|
|
ffmpeg \
|
|
libmagic1 \
|
|
sudo \
|
|
fonts-noto-color-emoji \
|
|
libreoffice-core \
|
|
libreoffice-impress \
|
|
libreoffice-writer \
|
|
&& apt-get clean && \
|
|
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 . .
|
|
|
|
# Copy and set permissions for entrypoint script
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
# Create directories for uploads and database
|
|
RUN mkdir -p app/static/uploads instance
|
|
|
|
# Set environment variables
|
|
ENV FLASK_APP=app.app:create_app
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV FLASK_ENV=production
|
|
|
|
# Expose port
|
|
EXPOSE 5000
|
|
|
|
# Create a non-root user and grant sudo access for dependency installation
|
|
RUN useradd -m -u 1000 appuser && \
|
|
chown -R appuser:appuser /app /docker-entrypoint.sh && \
|
|
echo "Defaults:appuser !requiretty, !use_pty" >> /etc/sudoers && \
|
|
echo "appuser ALL=(ALL) NOPASSWD: /usr/bin/apt-get" >> /etc/sudoers && \
|
|
echo "appuser ALL=(ALL) NOPASSWD: /app/install_libreoffice.sh" >> /etc/sudoers && \
|
|
echo "appuser ALL=(ALL) NOPASSWD: /app/install_emoji_fonts.sh" >> /etc/sudoers && \
|
|
chmod +x /app/install_libreoffice.sh /app/install_emoji_fonts.sh
|
|
|
|
USER appuser
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5000/').read()" || exit 1
|
|
|
|
# Run the application via entrypoint
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|