-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 1006 Bytes
/
Dockerfile
File metadata and controls
44 lines (33 loc) · 1006 Bytes
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
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY src/ ./src/
COPY scripts/ ./scripts/
COPY alembic/ ./alembic/
COPY alembic.ini .
# Create non-root user for security
RUN useradd -m -u 1000 telegram && \
mkdir -p /data/backups && \
chown -R telegram:telegram /app /data && \
chmod +x /app/scripts/entrypoint.sh
# 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
VOLUME ["/data"]
# Entrypoint runs migrations, then hands off to CMD
ENTRYPOINT ["/app/scripts/entrypoint.sh"]
# Default: show help (requires explicit command)
CMD ["python", "-m", "src"]