Fred808 commited on
Commit
01d889d
·
verified ·
1 Parent(s): 82c8d7f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -17
Dockerfile CHANGED
@@ -1,49 +1,33 @@
1
  # Use slim Python 3.11 image
2
  FROM python:3.11-slim
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
- # Set environment variables
8
  ENV PYTHONDONTWRITEBYTECODE=1
9
  ENV PYTHONUNBUFFERED=1
10
  ENV PORT=7860
11
 
12
- # Install system dependencies
13
  RUN apt-get update && apt-get install -y \
14
  gcc curl \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
- # Copy only requirements first (for better caching)
18
  COPY requirements.txt .
19
-
20
- # Install Python dependencies
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copy application code
24
  COPY app.py .
25
- COPY my_session.session . # 🔐 Pre-authenticated Telegram session
26
-
27
- # Copy templates and static directories
28
  COPY templates/ templates/
29
  COPY static/ static/
30
 
31
- # Make sure necessary directories exist
32
  RUN mkdir -p downloads
33
-
34
- # Set permissions
35
  RUN chmod -R 777 /app
36
 
37
- # Create a user for safer container execution
38
  RUN useradd -m -u 1000 user
39
  USER user
40
 
41
- # Expose port
42
  EXPOSE 7860
43
 
44
- # Health check (optional)
45
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
46
  CMD curl -f http://localhost:7860/ || exit 1
47
 
48
- # Start the app
49
  CMD ["python", "app.py"]
 
1
  # Use slim Python 3.11 image
2
  FROM python:3.11-slim
3
 
 
4
  WORKDIR /app
5
 
 
6
  ENV PYTHONDONTWRITEBYTECODE=1
7
  ENV PYTHONUNBUFFERED=1
8
  ENV PORT=7860
9
 
 
10
  RUN apt-get update && apt-get install -y \
11
  gcc curl \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
14
  COPY requirements.txt .
 
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
 
17
  COPY app.py .
18
+ COPY telegram_session_data.bin my_session.session # 🟢 Renamed safe copy
 
 
19
  COPY templates/ templates/
20
  COPY static/ static/
21
 
 
22
  RUN mkdir -p downloads
 
 
23
  RUN chmod -R 777 /app
24
 
 
25
  RUN useradd -m -u 1000 user
26
  USER user
27
 
 
28
  EXPOSE 7860
29
 
 
30
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
31
  CMD curl -f http://localhost:7860/ || exit 1
32
 
 
33
  CMD ["python", "app.py"]