first commit
This commit is contained in:
36
encoder/Dockerfile
Normal file
36
encoder/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
FROM php:7-apache
|
||||
|
||||
ENV DOMAIN localhost
|
||||
ENV DOMAIN_PROTOCOL http
|
||||
ENV ADMIN_PASSWORD password
|
||||
ENV DB_HOST mysql
|
||||
ENV DB_USER avideo
|
||||
ENV DB_PASSWORD password
|
||||
ENV PHP_MEMORY_LIMIT 2048M
|
||||
|
||||
ADD install.php /root/
|
||||
ADD entrypoint.sh /usr/local/bin/
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y wget git zip default-libmysqlclient-dev libbz2-dev libmemcached-dev libsasl2-dev libfreetype6-dev libicu-dev libjpeg-dev libmemcachedutil2 libpng-dev libxml2-dev mariadb-client ffmpeg libimage-exiftool-perl python3 curl python3-pip libzip-dev libonig-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype=/usr/include --with-jpeg=/usr/include \
|
||||
&& docker-php-ext-install -j$(nproc) bcmath bz2 calendar exif gd gettext iconv intl mbstring mysqli opcache pdo_mysql zip \
|
||||
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /root/.cache \
|
||||
&& a2enmod rewrite \
|
||||
&& service apache2 restart \
|
||||
&& curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl \
|
||||
&& chmod a+rx /usr/local/bin/youtube-dl \
|
||||
&& pip3 install -U youtube-dl \
|
||||
&& echo "post_max_size = 10G\nupload_max_filesize = 10G" > $PHP_INI_DIR/conf.d/upload.ini \
|
||||
&& echo "memory_limit = $PHP_MEMORY_LIMIT" > $PHP_INI_DIR/conf.d/memory.ini \
|
||||
&& echo "max_execution_time = 72000" > $PHP_INI_DIR/conf.d/execution_time.ini \
|
||||
&& git clone https://github.com/WWBN/AVideo-Encoder.git \
|
||||
&& mv AVideo-Encoder/* . \
|
||||
&& mv AVideo-Encoder/.[!.]* . \
|
||||
&& rm -rf AVideo-Encoder \
|
||||
&& chmod a+rx /usr/local/bin/entrypoint.sh \
|
||||
&& chown -R www-data:www-data /var/www/html
|
||||
|
||||
VOLUME ["/var/www/html/videos"]
|
||||
CMD ["entrypoint.sh"]
|
||||
4
encoder/entrypoint.sh
Executable file
4
encoder/entrypoint.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
php /root/install.php
|
||||
chown -R www-data:www-data /var/www/html
|
||||
apache2-foreground
|
||||
65
encoder/install.php
Normal file
65
encoder/install.php
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/php -q
|
||||
<?php
|
||||
$installationVersion = '3.3';
|
||||
$p = getenv('DOMAIN_PROTOCOL') ?: 'http';
|
||||
$d = getenv('DOMAIN') ?: 'localhost';
|
||||
$dbh = getenv('DB_HOST') ?: 'db-enc';
|
||||
$dbu = getenv('DB_USER') ?: 'avideo';
|
||||
$dbp = getenv('DB_PASSWORD');
|
||||
$ap = getenv('ADMIN_PASSWORD');
|
||||
$t = getenv('SITE_TITLE') ?: 'YouPHPtube';
|
||||
$l = getenv('LANG') ?: 'en';
|
||||
$en = getenv('ENCODER') ?: 'https://encoder1.avideo.com/';
|
||||
|
||||
$conn = @new mysqli($dbh, $dbu, $dbp, 'youPHPTubeEncoder');
|
||||
if ($conn->connect_error) {
|
||||
$conn = new mysqli($dbh, $dbu, $dbp);
|
||||
$sql = 'CREATE DATABASE IF NOT EXISTS youPHPTubeEncoder CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;';
|
||||
$conn->query($sql);
|
||||
$conn->select_db('youPHPTubeEncoder');
|
||||
$lines = file('/var/www/html/install/database.sql');
|
||||
$templine = '';
|
||||
foreach ($lines as $line) {
|
||||
if (substr($line, 0, 2) == '--' || $line == '') {
|
||||
continue;
|
||||
}
|
||||
$templine .= $line;
|
||||
if (substr(trim($line), -1, 1) == ';') {
|
||||
$conn->query($templine);
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
$sql = "INSERT INTO streamers (siteURL, user, pass, priority, created, modified, isAdmin) VALUES ('$p://$d/', 'admin', '$ap', 1, now(), now(), 1)";
|
||||
$conn->query($sql);
|
||||
$sql = "INSERT INTO configurations (id, allowedStreamersURL, defaultPriority, version, created, modified) VALUES (1, '$p://$d/', '1', '$installationVersion', now(), now())";
|
||||
$conn->query($sql);
|
||||
}
|
||||
$conn->close();
|
||||
|
||||
$file = '/var/www/html/videos/configuration.php';
|
||||
if (!file_exists($file)) {
|
||||
$content = "<?php
|
||||
\$global['configurationVersion'] = 2;
|
||||
\$global['webSiteRootURL'] = '$p://$d/';
|
||||
\$global['systemRootPath'] = '/var/www/html/';
|
||||
\$global['webSiteRootPath'] = '$d';
|
||||
\$global['disableConfigurations'] = false;
|
||||
\$global['disableBulkEncode'] = false;
|
||||
\$global['disableImportVideo'] = false;
|
||||
\$global['disableWebM'] = false;
|
||||
|
||||
\$mysqlHost = '$dbh';
|
||||
\$mysqlPort = '3306';
|
||||
\$mysqlUser = '$dbu';
|
||||
\$mysqlPass = '$dbp';
|
||||
\$mysqlDatabase = 'youPHPTubeEncoder';
|
||||
\$global['allowed'] = array('mp4', 'avi', 'mov', 'flv', 'mp3', 'wav', 'm4v', 'webm', 'wmv', 'mpg', 'mpeg', 'f4v', 'm4v', 'm4a', 'm2p', 'rm', 'vob', 'mkv', '3gp');
|
||||
/**
|
||||
* Do NOT change from here
|
||||
*/
|
||||
require_once \$global['systemRootPath'].'objects/include_config.php';
|
||||
";
|
||||
$fp = fopen($file, 'wb');
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
}
|
||||
Reference in New Issue
Block a user