diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..51d2317 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,37 @@ +# Git +.git +.gitignore + +# Python +__pycache__ +*.pyc +*.pyo +*.egg-info +.pytest_cache + +# IDE +.vscode +.idea +*.swp +*.swo + +# Downloads (keep directory but not files) +downloads/* +!downloads/.gitkeep + +# Logs +*.log +nohup.out + +# HAR files (large) +*.har + +# Test files +test_*.py +*.test.* +do_fix.py +do_fix.sh + +# OS files +.DS_Store +Thumbs.db diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7977899 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Install dependencies +RUN apt-get update && apt-get install -y \ + ffmpeg \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Copy application files +COPY . . + +# Install Python dependencies +RUN pip install --no-cache-dir -r requirements.txt 2>/dev/null || pip install --no-cache-dir \ + flask \ + requests \ + gunicorn \ + m3u8 \ + pypdl \ + python-slugify \ + yt-dlp \ + 2>/dev/null || true + +# Create downloads directory +RUN mkdir -p /app/downloads /app/cookies + +# Expose port +EXPOSE 8770 + +# Run with gunicorn for production +CMD ["gunicorn", "--bind", "0.0.0.0:8770", "--workers", "2", "--threads", "4", "app:app"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..05e8792 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + xstream-downloader: + build: . + container_name: xstream-downloader + ports: + - "8770:8770" + volumes: + - ./downloads:/app/downloads + - ./cookies:/app/cookies + environment: + - FLASK_ENV=production + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8770/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s