Browse Source

feat: docker of alltube

master
dnomd343 3 years ago
commit
23ef55a52d
  1. 18
      Dockerfile
  2. 12
      asset.sh
  3. 3
      init.sh
  4. 47
      nginx.conf

18
Dockerfile

@ -0,0 +1,18 @@
FROM alpine as asset
COPY ./ /
RUN sh /asset.sh
FROM alpine
COPY --from=asset /tmp/alltube/ /var/www/alltube/
RUN apk --update add --no-cache nginx ffmpeg python3 php php-fpm php-dom php-xml php-zip php-gmp php-json php-phar php-intl php-openssl php-mbstring php-gettext php-xmlwriter php-tokenizer php-simplexml && \
rm -rf /var/www/localhost && rm -rf /etc/nginx/http.d && \
mv -f /var/www/alltube/nginx.conf /etc/nginx/ && \
ln -s /usr/bin/python3 /usr/bin/python && \
mv /var/www/alltube/init.sh / && \
php /var/www/alltube/composer-setup.php && rm -f /var/www/alltube/composer-setup.php && \
mv ./composer.phar /usr/bin/composer && \
chmod 777 /var/www/alltube/templates_c && \
cd /var/www/alltube && composer install && \
cd ./config && mv config.example.yml config.yml
EXPOSE 80
CMD ["sh","init.sh"]

12
asset.sh

@ -0,0 +1,12 @@
get_github_latest_version() {
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
}
apk add curl wget
mkdir -p /tmp
get_github_latest_version "Rudloff/alltube"
wget https://github.com/Rudloff/alltube/releases/download/$VERSION/alltube-$VERSION.zip -O /tmp/alltube.zip
unzip -d /tmp/ /tmp/alltube.zip
wget https://install.phpcomposer.com/installer -O /tmp/alltube/composer-setup.php
mv /nginx.conf /tmp/alltube/
mv /init.sh /tmp/alltube/

3
init.sh

@ -0,0 +1,3 @@
/usr/sbin/php-fpm7
/usr/sbin/nginx
read -n 1

47
nginx.conf

@ -0,0 +1,47 @@
user nginx;
worker_processes auto;
pcre_jit on;
include /etc/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
root /var/www/alltube;
index index.php;
types {
text/html html htm shtml;
text/css css;
text/xml xml;
application/x-web-app-manifest+json webapp;
}
location ~ /\. {
deny all;
}
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
try_files $uri /index.php?$args;
fastcgi_buffers 4 16k;
fastcgi_buffer_size 16k;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param HTTPS 'ok';
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}
Loading…
Cancel
Save