Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (52 loc) · 1.84 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (52 loc) · 1.84 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Multi-stage Dockerfile for Telegram Multi-Account Message Sender
# Build stage
FROM python:3.11-slim AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy application code
COPY . .
# Runtime stage
FROM python:3.11-slim
LABEL org.opencontainers.image.description="Professional-grade desktop application for managing and sending messages across multiple Telegram accounts"
LABEL org.opencontainers.image.source="https://github.com/VoxHash/Telegram-Multi-Account-Message-Sender"
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libxext6 \
libxrender1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 telegram-sender
# Set working directory
WORKDIR /app
# Copy Python packages from builder stage
COPY --from=builder /root/.local /home/telegram-sender/.local
# Copy application code
COPY --chown=telegram-sender:telegram-sender . .
# Create app data directory
RUN mkdir -p /app/app_data/sessions /app/app_data/logs /app/content && \
chown -R telegram-sender:telegram-sender /app
# Switch to non-root user
USER telegram-sender
# Set environment variables
ENV PATH="/home/telegram-sender/.local/bin:${PATH}"
ENV PYTHONPATH="/app"
ENV QT_QPA_PLATFORM=offscreen
# Expose port (if needed for web interface)
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import app; print('OK')" || exit 1
# Default command
CMD ["python", "main.py"]