Fred808 commited on
Commit
12bc0c3
·
verified ·
1 Parent(s): c8ef052

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +0 -57
Dockerfile CHANGED
@@ -1,57 +0,0 @@
1
- # Use Python 3.11 slim image as base
2
- FROM python:3.11-slim
3
-
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1 \
6
- PYTHONUNBUFFERED=1 \
7
- DEBIAN_FRONTEND=noninteractive \
8
- PORT=7860
9
-
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"]