Files
script.service.ultimate/Dockerfile
T

122 lines
4.7 KiB
Docker
Raw Normal View History

2025-12-10 14:04:39 +01:00
# Ultimate Backend Streaming Service - Kodi addon in standalone Docker mode
2025-12-10 13:56:11 +01:00
FROM python:3.11-slim
2025-12-10 16:04:27 +01:00
# Build arguments
2025-12-10 14:04:39 +01:00
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG APP_USER=ultimate
ARG APP_HOME=/app
# Environment variables
2025-12-10 13:56:11 +01:00
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
TZ=UTC \
ULTIMATE_PORT=7777 \
ULTIMATE_COUNTRY=DE \
2025-12-10 14:04:39 +01:00
ULTIMATE_DEBUG=false \
2025-12-12 20:45:04 +01:00
ULTIMATE_EPG_URL="https://example.com/epg.xml.gz" \
2026-01-20 15:45:43 +01:00
PYTHONPATH=/app/lib:/app \
2026-02-10 10:51:19 +01:00
DRM_PLUGINS_PATH=/drm-plugins \
2026-02-12 22:58:36 +01:00
M3U_PLAYLISTS_PATH=/playlists \
SCRIPTS_PROVIDERS_PATH=/playlists
2025-12-10 13:56:11 +01:00
# Install system dependencies
2025-12-10 14:04:39 +01:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2025-12-10 13:56:11 +01:00
gcc \
g++ \
libxml2-dev \
libxslt-dev \
libffi-dev \
libssl-dev \
libxmlsec1-dev \
pkg-config \
curl \
2025-12-10 14:04:39 +01:00
ca-certificates \
&& apt-get clean \
2025-12-10 16:04:27 +01:00
&& rm -rf /var/lib/apt/lists/*
2025-12-10 13:56:11 +01:00
# Set working directory
2025-12-10 14:04:39 +01:00
WORKDIR ${APP_HOME}
2025-12-10 13:56:11 +01:00
2025-12-10 16:04:27 +01:00
# Copy requirements.txt first for better caching
COPY requirements.txt .
2025-12-10 13:56:11 +01:00
2025-12-10 14:04:39 +01:00
# Install Python dependencies
2025-12-10 16:04:27 +01:00
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Create user
RUN groupadd -g ${GROUP_ID} ${APP_USER} && \
useradd -u ${USER_ID} -g ${APP_USER} -m -s /bin/bash ${APP_USER}
2025-12-10 13:56:11 +01:00
2026-06-15 14:34:19 +02:00
# Create directories for new structure (including routes/streams)
RUN mkdir -p /config /logs /cache /drm-plugins /playlists /scripts && \
mkdir -p /app/routes /app/routes/streams /app/lib && \
chown -R ${USER_ID}:${GROUP_ID} /config /logs /cache /drm-plugins /playlists /scripts /app
2026-01-20 17:20:48 +01:00
# CRITICAL FIX: Copy the lib directory containing streaming_providers
COPY --chown=${USER_ID}:${GROUP_ID} lib/ /app/lib/
2026-01-16 19:51:49 +01:00
2026-01-20 15:26:41 +01:00
# Copy application code with new structure
COPY --chown=${USER_ID}:${GROUP_ID} service.py .
2026-06-15 14:34:19 +02:00
# Copy the entire routes directory (including streams subdirectory)
2026-01-20 15:26:41 +01:00
COPY --chown=${USER_ID}:${GROUP_ID} routes/ /app/routes/
2025-12-10 13:56:11 +01:00
2026-01-20 17:20:48 +01:00
# Copy resources directory (for web UI)
COPY --chown=${USER_ID}:${GROUP_ID} resources/ /app/resources/
2026-01-16 19:51:49 +01:00
# Create the directory structure for DRM plugins
RUN mkdir -p /app/lib/streaming_providers/base/drm/plugins && \
chown -R ${USER_ID}:${GROUP_ID} /app/lib/streaming_providers/base/drm
2026-01-20 17:20:48 +01:00
# Verify directory structure (for debugging)
2026-01-20 15:26:41 +01:00
RUN echo "=== Directory structure ===" && \
ls -la /app && \
2026-01-20 17:20:48 +01:00
echo "--- routes ---" && \
2026-06-15 14:34:19 +02:00
ls -la /app/routes/ 2>/dev/null || echo "ERROR: routes directory not found" && \
echo "--- routes/streams ---" && \
ls -la /app/routes/streams/ 2>/dev/null || echo "ERROR: routes/streams directory not found" && \
2026-01-20 17:20:48 +01:00
echo "--- lib ---" && \
2026-06-15 14:34:19 +02:00
ls -la /app/lib/ 2>/dev/null || echo "ERROR: lib directory not found" && \
2026-01-20 17:20:48 +01:00
echo "--- streaming_providers ---" && \
2026-06-15 14:34:19 +02:00
ls -la /app/lib/streaming_providers/ 2>/dev/null || echo "ERROR: streaming_providers not found"
# Validate critical split structure files exist
RUN echo "=== Validating split structure ===" && \
test -f /app/routes/__init__.py && echo "✓ routes/__init__.py" || (echo "✗ MISSING: routes/__init__.py" && exit 1) && \
test -f /app/routes/streams/__init__.py && echo "✓ routes/streams/__init__.py" || (echo "✗ MISSING: routes/streams/__init__.py" && exit 1) && \
test -f /app/routes/streams/channels.py && echo "✓ routes/streams/channels.py" || (echo "✗ MISSING: routes/streams/channels.py" && exit 1) && \
test -f /app/routes/streams/events.py && echo "✓ routes/streams/events.py" || (echo "✗ MISSING: routes/streams/events.py" && exit 1) && \
test -f /app/routes/streams/vod.py && echo "✓ routes/streams/vod.py" || (echo "✗ MISSING: routes/streams/vod.py" && exit 1) && \
test -f /app/routes/streams/recordings.py && echo "✓ routes/streams/recordings.py" || (echo "✗ MISSING: routes/streams/recordings.py" && exit 1) && \
test -f /app/service.py && echo "✓ service.py" || (echo "✗ MISSING: service.py" && exit 1) && \
echo "✓ All split structure files validated successfully!"
# Copy entrypoint script
2026-01-16 19:51:49 +01:00
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
2025-12-10 14:04:39 +01:00
# Switch to non-root user
USER ${USER_ID}
2025-12-10 16:04:27 +01:00
# Create default config
2025-12-10 14:04:39 +01:00
RUN if [ ! -f /config/config.json ]; then \
echo '{"default_country": "DE", "server_port": 7777, "debug_mode": false}' > /config/config.json; \
fi
2025-12-10 13:56:11 +01:00
2025-12-10 16:04:27 +01:00
# Expose port
2025-12-10 13:56:11 +01:00
EXPOSE ${ULTIMATE_PORT}
# Health check
2025-12-10 14:04:39 +01:00
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
2025-12-10 13:56:11 +01:00
CMD curl -f http://localhost:${ULTIMATE_PORT}/api/providers || exit 1
2025-12-10 16:04:27 +01:00
# Labels
2025-12-10 14:04:39 +01:00
LABEL maintainer="nirvana-7777" \
2026-06-15 14:34:19 +02:00
description="Ultimate Backend Streaming Service with split route modules" \
version="2.0"
2025-12-10 14:04:39 +01:00
2026-01-16 19:51:49 +01:00
# Entrypoint with wrapper script
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["python", "service.py", "--standalone", "--config-dir", "/config"]