build: push tvapp v2 docker files

This commit is contained in:
2025-02-20 13:10:51 -07:00
parent bee45668cc
commit 9e79e42d09
536 changed files with 142093 additions and 5531 deletions

View File

@@ -1,118 +1,127 @@
# syntax=docker/dockerfile:1
# #
# @project TVApp2
# @usage docker image which allows you to download a m3u playlist and EPG guide data from
# multiple IPTV services.
# @file Dockerfile
# @about This docker file installs:
# - nginx
# - php-fpm
# - theapptv
# @repo https://github.com/iFlip721/tvapp2
# https://github.com/aetherinox/tvapp2
# https://github.com/aetherinox/docker-base-alpine
# https://git.binaryninja.net/pub_projects/tvapp2
#
# you can build your own image by running
# amd64 docker build --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 -t tvapp2:1.0.0-amd64 -f Dockerfile .
# arm64 docker build --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:1.0.0-arm64 -f Dockerfile.aarch64 .
#
# if you prefer to use `docker buildx`
# create docker buildx create --driver docker-container --name container --bootstrap --use
# amd64 docker buildx build --no-cache --pull --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 --platform=linux/amd64 --output type=docker --output type=docker .
# arm64 docker buildx build --no-cache --pull --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 --platform=linux/arm64 --output type=docker --output type=docker .
# #
# #
# 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"
FROM ghcr.io/aetherinox/alpine-base:3.20-amd64
# #
# Set Args
# #
ARG BUILD_DATE
ARG BUILDDATE
ARG VERSION
ARG NGINX_VERSION
ARG CRON_TIME
ENV CRON_TIME="0/60 * * * *"
# #
# Set Labels
# #
LABEL maintainer="aetherinox, iFlip721"
LABEL org.opencontainers.image.authors="aetherinox, iFlip721"
LABEL org.opencontainers.image.vendor="BinaryNinja"
LABEL org.opencontainers.image.title="TvApp m3u playlist and EPG guide downloader"
LABEL org.opencontainers.image.description="Download m3u playlist and EPG guide data for the IPTV service TheTVApp"
LABEL org.opencontainers.image.source="https://git.binaryninja.net/pub_projects/tvapp2"
LABEL org.opencontainers.image.documentation="https://git.binaryninja.net/pub_projects/tvapp2/wiki"
LABEL org.opencontainers.image.url="https://git.binaryninja.net/pub_projects/tvapp2/packages"
LABEL org.opencontainers.image.licenses="MIT"
LABEL build_version="TvApp2 v${VERSION} build-date: ${BUILDDATE}"
# #
# Set Env Var
# #
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
ENV URL_REPO_BASE="https://github.com/aetherinox/alpine-base/pkgs/container/alpine-base"
ENV URL_REPO_APP="https://git.binaryninja.net/pub_projects/tvapp2"
ENV FILE_NAME="index.html"
ENV PORT_HTTP=4124
ENV NODE_VERSION=18.20.5
ENV YARN_VERSION=1.22.22
# #
# 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 \
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 "**** 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
apk add --no-cache \
wget \
bash \
nano \
npm \
openssl
# #
# Copy docker-entrypoint
# #
COPY docker-entrypoint.sh /usr/local/bin/
# #
# Set work directory
# #
WORKDIR /config/www
WORKDIR /usr/src/app
# #
# add local files
# copy node package.json to workdir
# #
COPY package*.json ./
# #
# install node (production)
# #
RUN npm install --only=production
# #
# Add local files
# #
COPY . .
# COPY node_modules/ package.json package-lock.json formatted.dat index.js ./
# #
# when copying with the command above, all files in root folder will be copied.
# #
RUN rm -rf ./root
RUN rm ./Dockerfile ./Dockerfile.aarch64 docker-entrypoint.sh
# #
# copy s6-overlays root to image root
# #
COPY root/ /
# #
# ports and volumes
# Ports and volumes
# #
EXPOSE ${PORT_HTTP} ${PORT_HTTPS}
# #
# Add Cron Task Files
# #
ADD run.sh /
ADD download.sh /
EXPOSE ${PORT_HTTP}/tcp
# #
# 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"]
CMD ["sh", "-c", "npm start"]