diff --git a/Dockerfile b/Dockerfile index 16aa994..5b6634a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,14 +24,10 @@ FROM ${ALPINE} # TODO: remove php-json after php8 (>=alpine:3.16) # TODO: /usr/bin/python already exist after alpine:3.17 RUN apk add --no-cache nginx python3 php-fpm php-mbstring \ - php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter - + php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter && \ + ln -s /usr/bin/python3 /usr/bin/python COPY --from=build /alltube/ /var/www/alltube/ - -#RUN apk add php-zip -#RUN -# mv -f /var/www/alltube/nginx.conf /etc/nginx/ && \ -# mv /var/www/alltube/init.sh / && \ - -#EXPOSE 80 -#CMD ["sh","init.sh"] +COPY ./init.sh /usr/bin/alltube +COPY ./nginx/ /etc/nginx/ +EXPOSE 80 +ENTRYPOINT ["alltube"] diff --git a/asset.sh b/asset.sh deleted file mode 100644 index d74b370..0000000 --- a/asset.sh +++ /dev/null @@ -1,12 +0,0 @@ -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/ diff --git a/init.sh b/init.sh old mode 100644 new mode 100755 index a73391a..b200d18 --- a/init.sh +++ b/init.sh @@ -1,6 +1,7 @@ +#!/usr/bin/env sh + if [ -n "$TITLE" ]; then sed -i "/^appName:/cappName: $TITLE" /var/www/alltube/config/config.yml fi -/usr/sbin/php-fpm7 /usr/sbin/nginx -read -n 1 +exec /usr/sbin/php-fpm7 -F diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 4806a30..0000000 --- a/nginx.conf +++ /dev/null @@ -1,47 +0,0 @@ -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; - } - } -} diff --git a/nginx/alltube.conf b/nginx/alltube.conf new file mode 100644 index 0000000..9aac555 --- /dev/null +++ b/nginx/alltube.conf @@ -0,0 +1,35 @@ +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; + } +} diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..89a8758 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,16 @@ +user root; +pcre_jit on; +worker_processes auto; +error_log /dev/stdout warn; + +events { + worker_connections 1024; +} + +http { + log_format access '[$time_iso8601] $remote_addr -> $scheme://$host - "$request"' + ' -> ($status) ↑$request_length ↓$bytes_sent {$http_user_agent}'; + access_log /dev/stdout access; + include /etc/nginx/mime.types; + include /etc/nginx/alltube.conf; +}