-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile.viewer
More file actions
50 lines (33 loc) · 1.12 KB
/
Dockerfile.viewer
File metadata and controls
50 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM python:3.14-slim
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements-viewer.txt .
# Install system libraries for Pillow (thumbnail generation)
RUN apt-get update && apt-get install -y --no-install-recommends \
libjpeg62-turbo libwebp7 libwebpmux3 zlib1g \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements-viewer.txt
# Copy only the necessary application code for the viewer
COPY src/__init__.py ./src/
COPY src/config.py ./src/
COPY src/realtime.py ./src/
COPY src/db/ ./src/db/
COPY src/web/ ./src/web/
# Create non-root user for security
RUN useradd -m -u 1000 telegram && \
mkdir -p /data/backups && \
chown -R telegram:telegram /app /data
# Switch to non-root user
USER telegram
# Set default environment variables
ENV BACKUP_PATH=/data/backups \
LOG_LEVEL=INFO \
PYTHONPATH=/app
# Volume for persistent data (read-only access to backups)
VOLUME ["/data"]
# Expose web viewer port
EXPOSE 8000
# Run web viewer
CMD ["uvicorn", "src.web.main:app", "--host", "0.0.0.0", "--port", "8000"]