-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.47 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.47 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
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# ffmpeg ships both `ffmpeg` and `ffprobe`, the optional external binaries the
# rich-markdown media path uses (probe video/audio metadata, extract a preview
# frame, convert an animated .gif to mp4). Without them large videos render as
# an empty rectangle in the Telegram clients and a .gif is rejected outright.
# It is the bulk of the image (~625 MB of the ~1 GB total, measured against
# the same build without it) — that is the price of the media path working
# the same inside the container as outside.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
ffmpeg \
tini \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml README.md ./
COPY src ./src
RUN pip install --upgrade pip \
&& pip install .
# Runtime state (Telethon session, SQLite DB, data/config.yml) is mounted at
# /data. Symlink data -> /data so the default loader path `data/config.yml`
# (resolved relative to WORKDIR) keeps working without an env override.
RUN useradd --create-home --uid 1000 app \
&& mkdir -p /data \
&& ln -s /data /app/data \
&& chown -R app:app /app /data
USER app
VOLUME ["/data"]
EXPOSE 8085
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["uvicorn", "telegram_assistant.http_api.app:create_app", \
"--factory", "--host", "0.0.0.0", "--port", "8085"]