YT1 / Dockerfile
Fred808's picture
Update Dockerfile
da44b9f verified
FROM python:3.11-slim-bullseye
WORKDIR /app
# Enable contrib and non-free repos, and install system dependencies
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
unrar \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app files
COPY main.py .
COPY docker-entrypoint.sh .
# Make entrypoint executable
RUN chmod +x docker-entrypoint.sh
# Create app folders
RUN mkdir -p /app/downloads /app/extracted /app/state
# Create and switch to non-root user
RUN useradd -m -s /bin/bash -u 1000 user && \
chown -R user:user /app
USER user
# Set environment variables
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
# Declare volumes
VOLUME ["/app/extracted", "/app/state"]
# Entrypoint and command
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD bash -c "python main.py && echo '🟑 Script done, container alive...' && tail -f /dev/null"