From 4b66debf619efc10d57209e9555934f4b7c649b4 Mon Sep 17 00:00:00 2001 From: Lyncoln Date: Sun, 1 Feb 2026 00:31:33 -0500 Subject: [PATCH] Added HTTP functions to host output file --- Dockerfile | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0700c0f..02aebc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,29 @@ -# Use slim Python image FROM python:3.11-slim -# Set working directory WORKDIR /app -# Copy script +# Copy the EPG script COPY tvj_epg.py . -# Install requests +# Install requests for API fetching RUN pip install --no-cache-dir requests -# Default update interval (hours) +# Default update interval in hours ENV UPDATE_INTERVAL=6 -# Run the script in a loop, using UPDATE_INTERVAL env variable -CMD sh -c 'while true; do \ - echo "$(date) - Updating TVJ EPG..."; \ - python tvj_epg.py; \ - echo "$(date) - Sleeping for ${UPDATE_INTERVAL} hours..."; \ - sleep $((${UPDATE_INTERVAL}*3600)); \ - done' +# Expose the new HTTP server port +EXPOSE 8787 + +# Start the EPG update loop in background, then start HTTP server +CMD sh -c '\ +mkdir -p /app/output; \ +# Run update loop in background \ +while true; do \ + echo "$(date) - Updating TVJ EPG..."; \ + python tvj_epg.py; \ + echo "$(date) - Sleeping for ${UPDATE_INTERVAL} hours..."; \ + sleep $((${UPDATE_INTERVAL}*3600)); \ +done & \ +# Start HTTP server to serve XML file on port 8787 \ +cd /app/output && python3 -m http.server 8787' +