Skip to content

Commit 3f9f861

Browse files
committed
change: add two versions, php and non-php
1 parent a69735f commit 3f9f861

File tree

5 files changed

+209
-20
lines changed

5 files changed

+209
-20
lines changed

.github/workflows/deploy-docker.yml

+53
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,28 @@ run-name: "⚙️ Deploy › Docker"
1313
# #
1414

1515
on:
16+
17+
# #
18+
# Trigger > Workflow Dispatch
19+
# #
20+
1621
workflow_dispatch:
22+
inputs:
23+
24+
# #
25+
# true: runs all actions, even ones not scheduled
26+
# false: only scheduled tasks will run
27+
# #
28+
29+
PRINT_ONLY:
30+
description: "📑 Print Debugs Only"
31+
required: true
32+
default: false
33+
type: boolean
34+
35+
# #
36+
# Trigger > Push
37+
# #
1738

1839
push:
1940
tags:
@@ -116,15 +137,31 @@ jobs:
116137
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
117138
type=ref,event=tag
118139
140+
# #
141+
# Release > Github > Debug
142+
# #
143+
144+
- name: "🪪 Debug › Print"
145+
id: task_release_gh_print
146+
run: |
147+
echo "registry ............. github"
148+
echo "github.actor.......... ${{ github.actor }}"
149+
echo "github.ref ........... ${{ github.ref }}"
150+
echo "github.event_name .... ${{ github.event_name }}"
151+
echo "tags ................. ${{ steps.task_release_gh_meta.outputs.tags }}"
152+
echo "labels ............... ${{ steps.task_release_gh_meta.outputs.labels }}"
153+
119154
# #
120155
# Release > Github > Build and Push
121156
# #
122157

123158
- name: "📦 Build and push"
124159
id: task_release_gh_push
125160
uses: docker/build-push-action@v3
161+
if: ( github.event_name == 'workflow_dispatch' && inputs.PRINT_ONLY == 'false' )
126162
with:
127163
context: .
164+
file: Dockerfile
128165
platforms: linux/amd64
129166
push: ${{ github.event_name != 'pull_request' }}
130167
tags: ${{ steps.task_release_gh_meta.outputs.tags }}
@@ -209,15 +246,31 @@ jobs:
209246
type=raw,value=latest,enable=${{ endsWith(github.ref, 'main') }}
210247
type=ref,event=tag
211248
249+
# #
250+
# Release > Dockerhub > Debug
251+
# #
252+
253+
- name: "🪪 Debug › Print"
254+
id: task_release_dh_print
255+
run: |
256+
echo "registry ............. dockerhub"
257+
echo "github.actor.......... ${{ github.actor }}"
258+
echo "github.ref ........... ${{ github.ref }}"
259+
echo "github.event_name .... ${{ github.event_name }}"
260+
echo "tags ................. ${{ steps.task_release_dh_meta.outputs.tags }}"
261+
echo "labels ............... ${{ steps.task_release_dh_meta.outputs.labels }}"
262+
212263
# #
213264
# Release > Dockerhub > Build and Push
214265
# #
215266

216267
- name: "📦 Build and push"
217268
id: task_release_dh_push
218269
uses: docker/build-push-action@v3
270+
if: ( github.event_name == 'workflow_dispatch' && inputs.PRINT_ONLY == 'false' )
219271
with:
220272
context: .
273+
file: Dockerfile
221274
platforms: linux/amd64
222275
push: ${{ github.event_name != 'pull_request' }}
223276
tags: ${{ steps.task_release_dh_meta.outputs.tags }}

Dockerfile

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# syntax=docker/dockerfile:1
22

3+
# #
4+
# @file Dockerfile
5+
# @about This docker file installs:
6+
# - nginx
7+
# - php-fpm
8+
# - theapptv
9+
# #
10+
311
# #
412
# Base Image
513
# This container uses a modified version of the Linux server alpine image
@@ -31,6 +39,7 @@ ARG VERSION
3139
ARG NGINX_VERSION
3240
ARG CRON_TIME
3341
ENV CRON_TIME="0/60 * * * *"
42+
ENV TZ="Etc/UTC"
3443

3544
ENV URL_XML="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml"
3645
ENV URL_XML_GZ="https://raw.githubusercontent.com/dtankdempse/thetvapp-m3u/refs/heads/main/guide/epg.xml.gz"
@@ -55,10 +64,6 @@ RUN \
5564
openssl \
5665
apache2-utils \
5766
nginx \
58-
php83 \
59-
php83-fileinfo \
60-
php83-fpm \
61-
php83-mbstring \
6267
nginx==${NGINX_VERSION} \
6368
nginx-mod-http-fancyindex==${NGINX_VERSION} && \
6469
echo "**** Install Build Packages ****" && \
@@ -74,18 +79,6 @@ RUN \
7479
rm -f /etc/nginx/http.d/default.conf && \
7580
rm -f /etc/nginx/conf.d/stream.conf && \
7681
rm -f /config/www/index.html && \
77-
echo "**** Check PHP version and symlink ****" && \
78-
if [ "$(readlink /usr/bin/php)" != "php83" ]; then \
79-
rm -rf /usr/bin/php && \
80-
ln -s /usr/bin/php83 /usr/bin/php; \
81-
fi && \
82-
echo "**** Configure PHP ****" && \
83-
sed -i "s#;error_log = log/php83/error.log.*#error_log = /config/log/php/error.log#g" \
84-
/etc/php83/php-fpm.conf && \
85-
sed -i "s#user = nobody.*#user = abc#g" \
86-
/etc/php83/php-fpm.d/www.conf && \
87-
sed -i "s#group = nobody.*#group = abc#g" \
88-
/etc/php83/php-fpm.d/www.conf && \
8982
echo "**** Setup Logrotate ****" && \
9083
sed -i "s#/var/log/messages {}.*# #g" \
9184
/etc/logrotate.conf && \

Dockerfile-php.template

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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"]

root/etc/s6-overlay/s6-rc.d/init-php/run

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ if [[ ! -f /config/log/php/error.log ]]; then
77
fi
88

99
# set default timezone
10-
printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini
10+
if [[ -f /etc/php83/conf.d/30_timezone.ini ]]; then
11+
printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini
12+
fi
1113

1214
# create local php.ini if it doesn't exist, set local timezone
1315
if [[ ! -f /config/php/php-local.ini ]]; then
@@ -17,12 +19,17 @@ fi
1719
# symlink user php-local.ini to image
1820
rm -rf /etc/php83/conf.d/php-local.ini
1921
rm -rf /etc/php83/conf.d/zzz_php-local.ini
20-
ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini
22+
23+
if [[ -f /config/php/php-local.ini ]] && [ -d /etc/php83/conf.d ]; then
24+
ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini
25+
fi
2126

2227
# create override for www.conf if it doesn't exist
2328
if [[ ! -f /config/php/www2.conf ]]; then
2429
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" >/config/php/www2.conf
2530
fi
2631

2732
# copy user www2.conf to image
28-
cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf
33+
if [[ -f /config/php/www2.conf ]] && [ -d /etc/php83/conf.d ]; then
34+
cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf
35+
fi
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
exec /usr/sbin/php-fpm83 -F
4+
if [[ -f /usr/sbin/php-fpm83 ]]; then
5+
exec /usr/sbin/php-fpm83 -F
6+
fi

0 commit comments

Comments
 (0)