2023-02-11 05:17:02 +00:00
|
|
|
FROM python:3.10.10-buster
|
|
|
|
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
|
2023-02-11 05:17:02 +00:00
|
|
|
RUN echo "deb http://ftp.us.debian.org/debian buster main non-free" >> /etc/apt/sources.list.d/fonts.list \
|
|
|
|
&& apt update \
|
|
|
|
# clone
|
|
|
|
&& apt install git wget curl -y \
|
2023-02-15 05:44:44 +00:00
|
|
|
&& git clone -b main https://github.com/PaiGramTeam/PaiGram.git /app \
|
2023-02-11 05:17:02 +00:00
|
|
|
# install dependencies \
|
|
|
|
&& pip install virtualenv==20.19.0 poetry==1.3.2 \
|
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.9.0/wait \
|
|
|
|
&& chmod +x /wait
|
|
|
|
ENTRYPOINT /wait && venv/bin/alembic upgrade head && venv/bin/python run.py
|