Enutrof commited on
Commit
fe4ade5
·
1 Parent(s): 808f27e

Added alt Dockerfile for subprocess bot and added task to README.

Browse files
Files changed (2) hide show
  1. Dockerfile_subprocess +54 -0
  2. README.md +1 -0
Dockerfile_subprocess ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
+
3
+ # Use an official Python runtime as a parent image
4
+ FROM python:3.11-slim
5
+
6
+ # Set environment variables
7
+ ENV PYTHONDONTWRITEBYTECODE=1
8
+ ENV PYTHONUNBUFFERED=1
9
+
10
+ # Install system dependencies
11
+ # - ffmpeg is crucial for yt-dlp for merging formats and segment downloads
12
+ # - git is sometimes needed by yt-dlp for updates or certain extractors (optional but good to have)
13
+ RUN apt-get update && \
14
+ apt-get install -y --no-install-recommends \
15
+ ffmpeg \
16
+ git \
17
+ && apt-get clean \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Set the working directory in the container
21
+ WORKDIR /app
22
+
23
+ # Copy the requirements file into the container at /app
24
+ COPY requirements.txt .
25
+
26
+ # Install any needed packages specified in requirements.txt
27
+ RUN pip install --no-cache-dir -r requirements.txt
28
+
29
+ # Copy the rest of the application's code into the container at /app
30
+ # This assumes your bot script is named bot.py and is in the same directory as the Dockerfile
31
+ # Adjust if your main script has a different name or is in a subdirectory.
32
+ COPY . .
33
+ # If your bot script is e.g. telegram_ytdlp_bot.py, use:
34
+ # COPY telegram_ytdlp_bot.py .
35
+ # COPY any_other_helper_files_if_any .
36
+
37
+ # Expose a volume for downloads (optional, but good for persisting data)
38
+ # The bot script currently uses "video_downloads/" relative to its execution path.
39
+ # So, /app/video_downloads/ will be the path inside the container.
40
+ VOLUME /app/video_downloads
41
+
42
+ # Expose a volume for cookies (optional, for easier management)
43
+ VOLUME /app/cookies
44
+
45
+ # Define environment variables for configuration (these will be set at runtime)
46
+ # You can set defaults here, but it's better to pass them during `docker run`
47
+ # ENV TELEGRAM_BOT_TOKEN=""
48
+ # ENV YOUTUBE_COOKIES_FILE_PATH="/app/cookies/youtube.txt"
49
+ # ENV INSTAGRAM_COOKIES_FILE_PATH="/app/cookies/instagram.txt"
50
+ # The bot script will need to be updated to use these _FILE_PATH variables
51
+
52
+ # Command to run the application
53
+ # Replace bot.py with the actual name of your main Python script
54
+ CMD ["python", "bot_subprocess.py"]
README.md CHANGED
@@ -36,5 +36,6 @@ Tasks:
36
  - Deployment
37
  - Set up docker first. ✅
38
  - Switch to using a subprocess ✅
 
39
  - Fix name extraction from file info
40
  - get around size limit (https://stackoverflow.com/a/77654947)
 
36
  - Deployment
37
  - Set up docker first. ✅
38
  - Switch to using a subprocess ✅
39
+ - Test to see which argument for constraining size works for youtube videos.
40
  - Fix name extraction from file info
41
  - get around size limit (https://stackoverflow.com/a/77654947)