|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | + |
| 3 | +# # |
| 4 | +# @file Dockerfile.IncPhp |
| 5 | +# @about This docker file installs: |
| 6 | +# - nginx |
| 7 | +# - php-fpm |
| 8 | +# - theapptv |
| 9 | +# # |
| 10 | + |
| 11 | +# # |
| 12 | +# Base Image |
| 13 | +# This container uses a modified version of the Linux server alpine image |
| 14 | +# # |
| 15 | + |
| 16 | +FROM ghcr.io/linuxserver/baseimage-alpine:3.20 |
| 17 | + |
| 18 | +# # |
| 19 | +# Set Labels |
| 20 | +# # |
| 21 | + |
| 22 | +LABEL maintainer="Aetherinox" |
| 23 | +LABEL org.opencontainers.image.authors="Aetherinox" |
| 24 | +LABEL org.opencontainers.image.vendor="Aetherinox" |
| 25 | +LABEL org.opencontainers.image.title="TheTVApp Grabber" |
| 26 | +LABEL org.opencontainers.image.description="thetvapp image by Aetherinox" |
| 27 | +LABEL org.opencontainers.image.source="https://github.com/Aetherinox/thetvapp-docker" |
| 28 | +LABEL org.opencontainers.image.documentation="https://github.com/Aetherinox/thetvapp-docker" |
| 29 | +LABEL org.opencontainers.image.url="https://github.com/Aetherinox/thetvapp-docker" |
| 30 | +LABEL org.opencontainers.image.licenses="MIT" |
| 31 | +LABEL build_version="1.0.0" |
| 32 | + |
| 33 | +# # |
| 34 | +# Set Args |
| 35 | +# # |
| 36 | + |
| 37 | +ARG BUILD_DATE |
| 38 | +ARG VERSION |
| 39 | +ARG NGINX_VERSION |
| 40 | +ARG CRON_TIME |
| 41 | +ENV CRON_TIME="0/60 * * * *" |
| 42 | +ENV TZ="Etc/UTC" |
| 43 | + |
| 44 | +ENV URL_XML="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml" |
| 45 | +ENV URL_XML_GZ="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml.gz" |
| 46 | +ENV URL_M3U="https://thetvapp-m3u.data-search.workers.dev/playlist" |
| 47 | +ENV FILE_NAME="thetvapp" |
| 48 | + |
| 49 | +ENV PORT_HTTP=80 |
| 50 | +ENV PORT_HTTPS=443 |
| 51 | + |
| 52 | +# # |
| 53 | +# Install |
| 54 | +# # |
| 55 | + |
| 56 | +RUN \ |
| 57 | + if [ -z ${NGINX_VERSION+x} ]; then \ |
| 58 | + NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ |
| 59 | + && awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ |
| 60 | + fi && \ |
| 61 | + apk add --no-cache \ |
| 62 | + wget \ |
| 63 | + logrotate \ |
| 64 | + openssl \ |
| 65 | + apache2-utils \ |
| 66 | + nginx \ |
| 67 | + php83 \ |
| 68 | + php83-fileinfo \ |
| 69 | + php83-fpm \ |
| 70 | + php83-mbstring \ |
| 71 | + nginx==${NGINX_VERSION} \ |
| 72 | + nginx-mod-http-fancyindex==${NGINX_VERSION} && \ |
| 73 | + echo "**** Install Build Packages ****" && \ |
| 74 | + echo "**** Configure Nginx ****" && \ |
| 75 | + echo 'fastcgi_param HTTP_PROXY ""; # https://httpoxy.org/' >> \ |
| 76 | + /etc/nginx/fastcgi_params && \ |
| 77 | + echo 'fastcgi_param PATH_INFO $fastcgi_path_info; # http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info' >> \ |
| 78 | + /etc/nginx/fastcgi_params && \ |
| 79 | + echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm' >> \ |
| 80 | + /etc/nginx/fastcgi_params && \ |
| 81 | + echo 'fastcgi_param SERVER_NAME $host; # Send HTTP_HOST as SERVER_NAME. If HTTP_HOST is blank, send the value of server_name from nginx (default is `_`)' >> \ |
| 82 | + /etc/nginx/fastcgi_params && \ |
| 83 | + rm -f /etc/nginx/http.d/default.conf && \ |
| 84 | + rm -f /etc/nginx/conf.d/stream.conf && \ |
| 85 | + rm -f /config/www/index.html && \ |
| 86 | + echo "**** Check PHP version and symlink ****" && \ |
| 87 | + if [ "$(readlink /usr/bin/php)" != "php83" ]; then \ |
| 88 | + rm -rf /usr/bin/php && \ |
| 89 | + ln -s /usr/bin/php83 /usr/bin/php; \ |
| 90 | + fi && \ |
| 91 | + echo "**** Configure PHP ****" && \ |
| 92 | + sed -i "s#;error_log = log/php83/error.log.*#error_log = /config/log/php/error.log#g" \ |
| 93 | + /etc/php83/php-fpm.conf && \ |
| 94 | + sed -i "s#user = nobody.*#user = abc#g" \ |
| 95 | + /etc/php83/php-fpm.d/www.conf && \ |
| 96 | + sed -i "s#group = nobody.*#group = abc#g" \ |
| 97 | + /etc/php83/php-fpm.d/www.conf && \ |
| 98 | + echo "**** Setup Logrotate ****" && \ |
| 99 | + sed -i "s#/var/log/messages {}.*# #g" \ |
| 100 | + /etc/logrotate.conf && \ |
| 101 | + sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \ |
| 102 | + /etc/periodic/daily/logrotate |
| 103 | + |
| 104 | +# # |
| 105 | +# Set work directory |
| 106 | +# # |
| 107 | + |
| 108 | +WORKDIR /config/www |
| 109 | + |
| 110 | +# # |
| 111 | +# add local files |
| 112 | +# # |
| 113 | + |
| 114 | +COPY root/ / |
| 115 | + |
| 116 | +# # |
| 117 | +# ports and volumes |
| 118 | +# # |
| 119 | + |
| 120 | +EXPOSE ${PORT_HTTP} ${PORT_HTTPS} |
| 121 | + |
| 122 | +# # |
| 123 | +# Add Cron Task Files |
| 124 | +# # |
| 125 | + |
| 126 | +ADD run.sh / |
| 127 | +ADD download.sh / |
| 128 | + |
| 129 | +# # |
| 130 | +# In case user sets up the cron for a longer duration, do a first run |
| 131 | +# and then keep the container running. Hacky, but whatever. |
| 132 | +# # |
| 133 | + |
| 134 | +CMD ["sh", "-c", "/run.sh ; /download.sh ; tail -f /dev/null"] |
0 commit comments