PaiGram/Dockerfile

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 \
&& pip install virtualenv poetry \
2022-10-27 12:13:57 +00:00
&& python3 -m virtualenv venv/ \
&& . venv/bin/activate \
2023-02-11 05:17:02 +00:00
&& poetry config virtualenvs.create false \
&& poetry source add --default mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \
2023-04-04 15:28:12 +00:00
&& poetry source add --secondary mirrors https://mirrors.aliyun.com/pypi/simple \
2022-10-27 12:13:57 +00:00
&& poetry install \
2023-02-11 05:17:02 +00:00
&& poetry install --extras 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 \
# 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