# Use the Bullseye-based image to have access to apt-get FROM python:3.11-slim-bullseye # Set the working directory WORKDIR /app # Create necessary directories for the application RUN mkdir -p /app/downloads /app/extracted /app/state # Copy the Python requirements file COPY requirements.txt . # Add non-free repository and install system dependencies RUN echo "deb http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list.d/non-free.list && \ apt-get update && \ apt-get install -y --no-install-recommends unrar && \ pip install --no-cache-dir -r requirements.txt && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Copy the rest of the application code COPY main.py . COPY docker-entrypoint.sh . # Make the entrypoint script executable RUN chmod +x docker-entrypoint.sh # Expose volumes for persistent data VOLUME ["/app/extracted", "/app/state"] # Create a non-root user and switch to it RUN useradd -m -s /bin/bash -u 1000 user && \ chown -R user:user /app USER user # Set environment variables for the application ENV PYTHONUNBUFFERED=1 ENV HF_TOKEN="" ENV SOURCE_REPO="Fred808/BG1" ENV DOWNLOAD_FOLDER=/app/downloads ENV EXTRACT_FOLDER=/app/extracted ENV STATE_FOLDER=/app/state # Set the entrypoint and default command ENTRYPOINT ["./docker-entrypoint.sh"] CMD ["python", "main.py"]