Fred808 commited on
Commit
545e6d0
·
verified ·
1 Parent(s): d3f13be

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -19
Dockerfile CHANGED
@@ -10,43 +10,48 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
10
  # Set work directory
11
  WORKDIR /app
12
 
13
- # Install system dependencies including additional tools for anti-detection
14
- RUN apt-get update && apt-get install -y \
15
  ffmpeg \
16
  curl \
17
  wget \
18
  ca-certificates \
 
 
19
  && rm -rf /var/lib/apt/lists/*
20
 
 
 
 
 
 
21
  # Copy requirements first for better caching
22
  COPY requirements.txt .
23
 
24
  # Install Python dependencies
25
- RUN pip install --no-cache-dir --upgrade pip && \
26
- pip install --no-cache-dir -r requirements.txt
27
 
28
- # Copy application code
29
  COPY . .
30
 
31
- # Create downloads directory with proper permissions
32
- RUN mkdir -p /tmp/downloads && \
33
- chmod 755 /tmp/downloads
34
 
35
- # Create non-root user for security
36
- RUN useradd --create-home --shell /bin/bash app && \
37
- chown -R app:app /app && \
38
- chown -R app:app /tmp/downloads
39
 
40
  # Switch to non-root user
41
  USER app
42
 
43
- # Expose port
44
- EXPOSE 7860
45
 
46
- # Health check with longer timeout for anti-detection measures
47
- HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=3 \
48
- CMD curl -f http://localhost:7860/health || exit 1
49
 
50
- # Run the application
51
  CMD ["python", "main.py"]
52
-
 
10
  # Set work directory
11
  WORKDIR /app
12
 
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
  ffmpeg \
16
  curl \
17
  wget \
18
  ca-certificates \
19
+ gnupg \
20
+ && apt-get clean \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Install latest yt-dlp binary and auto-update it
24
+ RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
25
+ && chmod a+rx /usr/local/bin/yt-dlp \
26
+ && yt-dlp -vU
27
+
28
  # Copy requirements first for better caching
29
  COPY requirements.txt .
30
 
31
  # Install Python dependencies
32
+ RUN pip install --no-cache-dir --upgrade pip \
33
+ && pip install --no-cache-dir -r requirements.txt
34
 
35
+ # Copy the rest of your app
36
  COPY . .
37
 
38
+ # Create a downloads directory with proper permissions
39
+ RUN mkdir -p /tmp/downloads && chmod 755 /tmp/downloads
 
40
 
41
+ # Create a non-root user and give access to app and temp directories
42
+ RUN useradd --create-home --shell /bin/bash app \
43
+ && chown -R app:app /app \
44
+ && chown -R app:app /tmp/downloads
45
 
46
  # Switch to non-root user
47
  USER app
48
 
49
+ # Expose app port
50
+ EXPOSE ${PORT}
51
 
52
+ # Healthcheck endpoint
53
+ HEALTHCHECK --interval=60s --timeout=30s --start-period=10s --retries=3 \
54
+ CMD curl -f http://localhost:${PORT}/health || exit 1
55
 
56
+ # Start the app
57
  CMD ["python", "main.py"]