PaiGram/Dockerfile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.9 KiB
Docker
Raw Normal View History

FROM python:3.12-bookworm
2023-02-11 05:17:02 +00:00
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
LANG=zh_CN.UTF-8 \
SHELL=/bin/bash
SHELL ["/bin/bash", "-c"]
2022-10-27 12:13:57 +00:00
WORKDIR /app
RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list \
2023-02-11 05:17:02 +00:00
&& apt update \
# clone
2023-04-14 04:16:18 +00:00
&& apt install git wget curl ffmpeg -y \
2023-08-05 05:45:38 +00:00
&& git clone -b main --recursive https://github.com/PaiGramTeam/PaiGram.git /app \
2023-02-11 05:17:02 +00:00
# install dependencies \
2024-06-04 11:35:23 +00:00
&& pip install virtualenv pdm \
2022-10-27 12:13:57 +00:00
&& python3 -m virtualenv venv/ \
&& . venv/bin/activate \
&& pdm use -f venv \
2024-06-04 11:35:23 +00:00
&& pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& pdm install \
&& pdm install -G :all \
2022-10-27 12:13:57 +00:00
&& playwright install chromium \
2023-02-11 05:17:02 +00:00
&& playwright install-deps chromium \
## set timezone
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
# create cache folder
2022-10-27 12:13:57 +00:00
&& mkdir cache/ \
2023-02-11 05:17:02 +00:00
# clean
&& apt-get clean -y \
&& rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
~/.cache/pip \
~/.cache/pypoetry \
2024-06-04 11:35:23 +00:00
~/.cache/pdm \
2023-02-11 05:17:02 +00:00
# Add the wait script to the image
&& wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.12.1/wait \
2023-02-11 05:17:02 +00:00
&& chmod +x /wait
ENTRYPOINT /wait && venv/bin/alembic upgrade head && venv/bin/python run.py