change: add two versions, php and non-php

This commit is contained in:
2024-12-01 11:08:35 -07:00
parent a69735f7f2
commit 3f9f861400
5 changed files with 209 additions and 20 deletions

View File

@@ -13,7 +13,28 @@ run-name: "⚙️ Deploy Docker"
# # # #
on: on:
# #
# Trigger > Workflow Dispatch
# #
workflow_dispatch: workflow_dispatch:
inputs:
# #
# true: runs all actions, even ones not scheduled
# false: only scheduled tasks will run
# #
PRINT_ONLY:
description: "📑 Print Debugs Only"
required: true
default: false
type: boolean
# #
# Trigger > Push
# #
push: push:
tags: tags:
@@ -116,6 +137,20 @@ jobs:
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }} type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
type=ref,event=tag type=ref,event=tag
# #
# Release > Github > Debug
# #
- name: "🪪 Debug Print"
id: task_release_gh_print
run: |
echo "registry ............. github"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "tags ................. ${{ steps.task_release_gh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_gh_meta.outputs.labels }}"
# # # #
# Release > Github > Build and Push # Release > Github > Build and Push
# # # #
@@ -123,8 +158,10 @@ jobs:
- name: "📦 Build and push" - name: "📦 Build and push"
id: task_release_gh_push id: task_release_gh_push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
if: ( github.event_name == 'workflow_dispatch' && inputs.PRINT_ONLY == 'false' )
with: with:
context: . context: .
file: Dockerfile
platforms: linux/amd64 platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gh_meta.outputs.tags }} tags: ${{ steps.task_release_gh_meta.outputs.tags }}
@@ -209,6 +246,20 @@ jobs:
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }} type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
type=ref,event=tag type=ref,event=tag
# #
# Release > Dockerhub > Debug
# #
- name: "🪪 Debug Print"
id: task_release_dh_print
run: |
echo "registry ............. dockerhub"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "tags ................. ${{ steps.task_release_dh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_dh_meta.outputs.labels }}"
# # # #
# Release > Dockerhub > Build and Push # Release > Dockerhub > Build and Push
# # # #
@@ -216,8 +267,10 @@ jobs:
- name: "📦 Build and push" - name: "📦 Build and push"
id: task_release_dh_push id: task_release_dh_push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
if: ( github.event_name == 'workflow_dispatch' && inputs.PRINT_ONLY == 'false' )
with: with:
context: . context: .
file: Dockerfile
platforms: linux/amd64 platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_dh_meta.outputs.tags }} tags: ${{ steps.task_release_dh_meta.outputs.tags }}

View File

@@ -1,5 +1,13 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
# #
# @file Dockerfile
# @about This docker file installs:
# - nginx
# - php-fpm
# - theapptv
# #
# # # #
# Base Image # Base Image
# This container uses a modified version of the Linux server alpine image # This container uses a modified version of the Linux server alpine image
@@ -31,6 +39,7 @@ ARG VERSION
ARG NGINX_VERSION ARG NGINX_VERSION
ARG CRON_TIME ARG CRON_TIME
ENV CRON_TIME="0/60 * * * *" ENV CRON_TIME="0/60 * * * *"
ENV TZ="Etc/UTC"
ENV URL_XML="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml" ENV URL_XML="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml"
ENV URL_XML_GZ="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml.gz" ENV URL_XML_GZ="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml.gz"
@@ -55,10 +64,6 @@ RUN \
openssl \ openssl \
apache2-utils \ apache2-utils \
nginx \ nginx \
php83 \
php83-fileinfo \
php83-fpm \
php83-mbstring \
nginx==${NGINX_VERSION} \ nginx==${NGINX_VERSION} \
nginx-mod-http-fancyindex==${NGINX_VERSION} && \ nginx-mod-http-fancyindex==${NGINX_VERSION} && \
echo "**** Install Build Packages ****" && \ echo "**** Install Build Packages ****" && \
@@ -74,18 +79,6 @@ RUN \
rm -f /etc/nginx/http.d/default.conf && \ rm -f /etc/nginx/http.d/default.conf && \
rm -f /etc/nginx/conf.d/stream.conf && \ rm -f /etc/nginx/conf.d/stream.conf && \
rm -f /config/www/index.html && \ rm -f /config/www/index.html && \
echo "**** Check PHP version and symlink ****" && \
if [ "$(readlink /usr/bin/php)" != "php83" ]; then \
rm -rf /usr/bin/php && \
ln -s /usr/bin/php83 /usr/bin/php; \
fi && \
echo "**** Configure PHP ****" && \
sed -i "s#;error_log = log/php83/error.log.*#error_log = /config/log/php/error.log#g" \
/etc/php83/php-fpm.conf && \
sed -i "s#user = nobody.*#user = abc#g" \
/etc/php83/php-fpm.d/www.conf && \
sed -i "s#group = nobody.*#group = abc#g" \
/etc/php83/php-fpm.d/www.conf && \
echo "**** Setup Logrotate ****" && \ echo "**** Setup Logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" \ sed -i "s#/var/log/messages {}.*# #g" \
/etc/logrotate.conf && \ /etc/logrotate.conf && \

134
Dockerfile-php.template Normal file
View File

@@ -0,0 +1,134 @@
# syntax=docker/dockerfile:1
# #
# @file Dockerfile.IncPhp
# @about This docker file installs:
# - nginx
# - php-fpm
# - theapptv
# #
# #
# Base Image
# This container uses a modified version of the Linux server alpine image
# #
FROM ghcr.io/linuxserver/baseimage-alpine:3.20
# #
# Set Labels
# #
LABEL maintainer="Aetherinox"
LABEL org.opencontainers.image.authors="Aetherinox"
LABEL org.opencontainers.image.vendor="Aetherinox"
LABEL org.opencontainers.image.title="TheTVApp Grabber"
LABEL org.opencontainers.image.description="thetvapp image by Aetherinox"
LABEL org.opencontainers.image.source="https://github.com/Aetherinox/thetvapp-docker"
LABEL org.opencontainers.image.documentation="https://github.com/Aetherinox/thetvapp-docker"
LABEL org.opencontainers.image.url="https://github.com/Aetherinox/thetvapp-docker"
LABEL org.opencontainers.image.licenses="MIT"
LABEL build_version="1.0.0"
# #
# Set Args
# #
ARG BUILD_DATE
ARG VERSION
ARG NGINX_VERSION
ARG CRON_TIME
ENV CRON_TIME="0/60 * * * *"
ENV TZ="Etc/UTC"
ENV URL_XML="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml"
ENV URL_XML_GZ="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml.gz"
ENV URL_M3U="https://thetvapp-m3u.data-search.workers.dev/playlist"
ENV FILE_NAME="thetvapp"
ENV PORT_HTTP=80
ENV PORT_HTTPS=443
# #
# Install
# #
RUN \
if [ -z ${NGINX_VERSION+x} ]; then \
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
fi && \
apk add --no-cache \
wget \
logrotate \
openssl \
apache2-utils \
nginx \
php83 \
php83-fileinfo \
php83-fpm \
php83-mbstring \
nginx==${NGINX_VERSION} \
nginx-mod-http-fancyindex==${NGINX_VERSION} && \
echo "**** Install Build Packages ****" && \
echo "**** Configure Nginx ****" && \
echo 'fastcgi_param HTTP_PROXY ""; # https://httpoxy.org/' >> \
/etc/nginx/fastcgi_params && \
echo 'fastcgi_param PATH_INFO $fastcgi_path_info; # http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info' >> \
/etc/nginx/fastcgi_params && \
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' >> \
/etc/nginx/fastcgi_params && \
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 `_`)' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/http.d/default.conf && \
rm -f /etc/nginx/conf.d/stream.conf && \
rm -f /config/www/index.html && \
echo "**** Check PHP version and symlink ****" && \
if [ "$(readlink /usr/bin/php)" != "php83" ]; then \
rm -rf /usr/bin/php && \
ln -s /usr/bin/php83 /usr/bin/php; \
fi && \
echo "**** Configure PHP ****" && \
sed -i "s#;error_log = log/php83/error.log.*#error_log = /config/log/php/error.log#g" \
/etc/php83/php-fpm.conf && \
sed -i "s#user = nobody.*#user = abc#g" \
/etc/php83/php-fpm.d/www.conf && \
sed -i "s#group = nobody.*#group = abc#g" \
/etc/php83/php-fpm.d/www.conf && \
echo "**** Setup Logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" \
/etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate
# #
# Set work directory
# #
WORKDIR /config/www
# #
# add local files
# #
COPY root/ /
# #
# ports and volumes
# #
EXPOSE ${PORT_HTTP} ${PORT_HTTPS}
# #
# Add Cron Task Files
# #
ADD run.sh /
ADD download.sh /
# #
# In case user sets up the cron for a longer duration, do a first run
# and then keep the container running. Hacky, but whatever.
# #
CMD ["sh", "-c", "/run.sh ; /download.sh ; tail -f /dev/null"]

View File

@@ -7,7 +7,9 @@ if [[ ! -f /config/log/php/error.log ]]; then
fi fi
# set default timezone # set default timezone
if [[ -f /etc/php83/conf.d/30_timezone.ini ]]; then
printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini
fi
# create local php.ini if it doesn't exist, set local timezone # create local php.ini if it doesn't exist, set local timezone
if [[ ! -f /config/php/php-local.ini ]]; then if [[ ! -f /config/php/php-local.ini ]]; then
@@ -17,7 +19,10 @@ fi
# symlink user php-local.ini to image # symlink user php-local.ini to image
rm -rf /etc/php83/conf.d/php-local.ini rm -rf /etc/php83/conf.d/php-local.ini
rm -rf /etc/php83/conf.d/zzz_php-local.ini rm -rf /etc/php83/conf.d/zzz_php-local.ini
if [[ -f /config/php/php-local.ini ]] && [ -d /etc/php83/conf.d ]; then
ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini
fi
# create override for www.conf if it doesn't exist # create override for www.conf if it doesn't exist
if [[ ! -f /config/php/www2.conf ]]; then if [[ ! -f /config/php/www2.conf ]]; then
@@ -25,4 +30,6 @@ if [[ ! -f /config/php/www2.conf ]]; then
fi fi
# copy user www2.conf to image # copy user www2.conf to image
if [[ -f /config/php/www2.conf ]] && [ -d /etc/php83/conf.d ]; then
cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf
fi

View File

@@ -1,4 +1,6 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash # shellcheck shell=bash
if [[ -f /usr/sbin/php-fpm83 ]]; then
exec /usr/sbin/php-fpm83 -F exec /usr/sbin/php-fpm83 -F
fi