FROM nvidia/cuda:12.0.0-base-ubuntu22.04 # Metadata LABEL maintainer="encoderPro" LABEL description="GPU-accelerated media encoding with web dashboard" LABEL version="3.1.0" # Prevent interactive prompts ENV DEBIAN_FRONTEND=noninteractive # Install dependencies RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ ffmpeg \ wget \ procps \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies RUN pip3 install --no-cache-dir \ pyyaml \ flask \ flask-cors # Create application directory WORKDIR /app # Copy application files COPY reencode.py /app/reencode.py COPY dashboard.py /app/dashboard.py COPY quality_checker.py /app/quality_checker.py COPY config.yaml /app/config.yaml.example COPY config-nvidia.yaml /app/config-nvidia.yaml.example COPY config-intel.yaml /app/config-intel.yaml.example COPY config-cpu.yaml /app/config-cpu.yaml.example COPY templates/ /app/templates/ COPY static/ /app/static/ # Create non-root user RUN groupadd -r encoder && useradd -r -g encoder -u 1000 encoder # Create mount points with proper ownership RUN mkdir -p /movies /archive /work /config /logs /db && \ chown -R encoder:encoder /app /db /logs /config /work # Set proper permissions RUN chmod +x /app/reencode.py /app/dashboard.py # Entry point script (must be done as root before USER switch) COPY docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh # Switch to non-root user USER encoder # Environment variables with defaults ENV MOVIES_DIR=/movies \ ARCHIVE_DIR=/archive \ WORK_DIR=/work \ STATE_DB=/db/state.db \ LOG_DIR=/logs \ CONFIG_FILE=/config/config.yaml \ REENCODE_SCRIPT=/app/reencode.py \ DASHBOARD_HOST=0.0.0.0 \ DASHBOARD_PORT=5000 # Expose dashboard port EXPOSE 5000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost:5000/api/health || exit 1 ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["dashboard"]