-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
38 lines (29 loc) · 1.47 KB
/
Dockerfile
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
FROM python:3.11-alpine AS i18n-build
COPY dev-requirements.txt /tmp/dev-requirements.txt
RUN pip install --no-cache-dir -r /tmp/dev-requirements.txt
COPY locales /tmp/locales
# Having no locales raises an error and is expected to fail, continuing anyway
RUN pybabel compile -D evgfilim1-userbot -d /tmp/locales || true
FROM jrottenberg/ffmpeg:6.0-ubuntu2004 AS runtime
WORKDIR /app
RUN useradd -Ud /app userbot \
&& mkdir -pm700 /data \
&& chown -R userbot:userbot /data \
&& apt update \
&& apt install -y --no-install-recommends gpg dirmngr gpg-agent \
&& echo 'deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu focal main' >>/etc/apt/sources.list \
&& echo 'deb-src https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu focal main' >>/etc/apt/sources.list \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv F23C5A6CF475977595C89F51BA6932366A755776 \
&& apt update \
&& apt install -y --no-install-recommends python3.11 python3.11-distutils libmagic1 curl \
&& { curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11; } \
&& apt autoremove -y gpg dirmngr gpg-agent curl --purge \
&& apt clean -y \
&& rm -rf /var/lib/apt/* /root/.cache /var/log/* /var/cache/*
VOLUME /data
COPY requirements.txt ./
RUN python3.11 -m pip install --no-cache-dir -r requirements.txt
COPY --from=i18n-build /tmp/locales ./locales
COPY userbot ./userbot
USER userbot:userbot
ENTRYPOINT ["/usr/bin/env", "python3.11", "-m", "userbot"]