Tube / Dockerfile
madibaalbert's picture
Upload 6 files
f5a29cc verified
# =============================================================================
# OMNITUBE (AVideo) pour Hugging Face Spaces - v3
# Fix : boucle infinie init.sh + setup one-shot
# =============================================================================
FROM bitnami/minideb:bookworm
LABEL maintainer="Madiba - OmniGroup Sovereignty"
USER root
ENV DEBIAN_FRONTEND=noninteractive
ENV PERSISTENT_VOLUME=/data
# -----------------------------------------------------------------------------
# 1. INSTALLATION DES DEPENDANCES
# -----------------------------------------------------------------------------
RUN install_packages -y \
ca-certificates \
curl \
wget \
git \
mariadb-server \
mariadb-client \
apache2 \
libapache2-mod-php8.2 \
php8.2-mysql \
php8.2-xml \
php8.2-gd \
php8.2-curl \
php8.2-zip \
php8.2-mbstring \
php8.2-intl \
php8.2-bcmath \
php8.2-opcache \
php8.2-readline \
ffmpeg \
libimage-exiftool-perl \
python3 \
python3-pip \
supervisor \
openssl \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip3 install --break-system-packages yt-dlp
# -----------------------------------------------------------------------------
# 2. CONFIGURATION PHP
# -----------------------------------------------------------------------------
RUN echo "upload_max_filesize = 10G" > /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "post_max_size = 10G" >> /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "memory_limit = 4G" >> /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "max_execution_time = 7200" >> /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "max_input_time = 7200" >> /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "max_file_uploads = 20" >> /etc/php/8.2/apache2/conf.d/99-omni.ini \
&& echo "date.timezone = UTC" >> /etc/php/8.2/apache2/conf.d/99-omni.ini
# -----------------------------------------------------------------------------
# 3. CONFIGURATION APACHE
# -----------------------------------------------------------------------------
RUN a2enmod rewrite remoteip headers \
&& a2dismod mpm_event \
&& a2enmod mpm_prefork
# AllowOverride All GLOBAL (critique pour AVideo)
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
# ServerName pour eviter le warning
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Ports.conf : ecoute sur 7860
RUN echo "Listen 7860" > /etc/apache2/ports.conf
# VirtualHost
RUN cat <<'APACHEEOF' > /etc/apache2/sites-available/000-default.conf
<VirtualHost *:7860>
ServerName localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /data/videos/logs/apache_error.log
CustomLog /data/videos/logs/apache_access.log combined
</VirtualHost>
APACHEEOF
# RemoteIP pour proxy HF
RUN echo "RemoteIPHeader X-Forwarded-For" > /etc/apache2/conf-available/remoteip.conf \
&& echo "RemoteIPInternalProxy 127.0.0.1" >> /etc/apache2/conf-available/remoteip.conf \
&& a2enconf remoteip
# -----------------------------------------------------------------------------
# 4. INSTALLATION AVIDEO
# -----------------------------------------------------------------------------
RUN rm -rf /var/www/html/* \
&& git clone --depth 1 https://github.com/WWBN/AVideo.git /var/www/html \
&& cd /var/www/html \
&& git clone --depth 1 https://github.com/WWBN/AVideo-Encoder.git upload \
&& chown -R www-data:www-data /var/www/html
# .htaccess AVideo
RUN cat <<'HTEOF' > /var/www/html/.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
HTEOF
# .htaccess Encoder
RUN cat <<'HTEOF' > /var/www/html/upload/.htaccess
RewriteEngine On
RewriteBase /upload/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
HTEOF
# -----------------------------------------------------------------------------
# 5. SUPERVISOR + INIT
# -----------------------------------------------------------------------------
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY init.sh /init.sh
RUN chmod +x /init.sh
# -----------------------------------------------------------------------------
# 6. VARIABLES D'ENVIRONNEMENT
# -----------------------------------------------------------------------------
ENV OMNITUBE_WEBSERVER_HOSTNAME=__CHANGE_ME__ \
OMNITUBE_ADMIN_PASSWORD=__CHANGE_ME__ \
OMNITUBE_ADMIN_EMAIL=__CHANGE_ME__ \
OMNITUBE_SALT=__CHANGE_ME__
ENV MYSQL_ROOT_PASSWORD=OmniGroup123! \
MYSQL_DATABASE=avideo \
MYSQL_USER=avideo \
MYSQL_PASSWORD=avideo123!
EXPOSE 7860
CMD ["/init.sh"]