2021-11-01 06:06:13 +00:00
|
|
|
FROM python:3.8 as requirements-stage
|
|
|
|
|
|
|
|
WORKDIR /tmp
|
|
|
|
|
|
|
|
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
|
|
|
|
|
|
|
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -o install-poetry.py
|
|
|
|
|
|
|
|
RUN python install-poetry.py --yes
|
|
|
|
|
|
|
|
ENV PATH="${PATH}:/root/.local/bin"
|
|
|
|
|
|
|
|
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
|
|
|
|
|
2020-09-17 14:42:41 +00:00
|
|
|
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
|
|
|
|
|
2021-11-01 06:06:13 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2021-04-02 11:35:49 +00:00
|
|
|
ENV LANG zh_CN.UTF-8
|
|
|
|
ENV LANGUAGE zh_CN.UTF-8
|
|
|
|
ENV LC_ALL zh_CN.UTF-8
|
2021-06-19 16:09:19 +00:00
|
|
|
ENV TZ Asia/Shanghai
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
2021-09-11 09:47:58 +00:00
|
|
|
ENV MAX_WORKERS 1
|
|
|
|
ENV APP_MODULE bot:app
|
|
|
|
# ENV XVFB_INSTALLED true
|
|
|
|
|
|
|
|
# RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak &&\
|
|
|
|
# echo "deb http://mirrors.aliyun.com/debian/ buster main" >> /etc/apt/sources.list\
|
|
|
|
# && echo "deb http://mirrors.aliyun.com/debian/ buster-updates main" >> /etc/apt/sources.list\
|
|
|
|
# && echo "deb http://mirrors.aliyun.com/debian-security/ buster/updates main" >> /etc/apt/sources.list\
|
|
|
|
# && apt-get update && apt-get install -y locales locales-all fonts-noto
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y locales locales-all fonts-noto
|
2021-04-02 11:35:49 +00:00
|
|
|
|
2021-04-02 06:52:07 +00:00
|
|
|
# RUN python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
|
2020-09-17 14:42:41 +00:00
|
|
|
|
2021-11-01 06:06:13 +00:00
|
|
|
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
|
2020-09-17 14:42:41 +00:00
|
|
|
|
2021-11-01 06:06:13 +00:00
|
|
|
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
2020-09-17 14:42:41 +00:00
|
|
|
|
2021-11-01 06:06:13 +00:00
|
|
|
RUN echo "Install playwright headless browser..." \
|
|
|
|
&& playwright install chromium \
|
2021-06-19 16:09:19 +00:00
|
|
|
&& apt-get install -y libnss3-dev libxss1 libasound2 libxrandr2\
|
2021-11-01 06:06:13 +00:00
|
|
|
libatk1.0-0 libgtk-3-0 libgbm-dev libxshmfence1
|
2021-03-14 04:58:50 +00:00
|
|
|
|
2021-09-11 09:47:58 +00:00
|
|
|
# RUN echo "Install wkhtmltox renderer..." \
|
|
|
|
# && chmod +x ./scripts/download_wkhtmltox.sh \
|
|
|
|
# && ./scripts/download_wkhtmltox.sh buster_amd64 \
|
|
|
|
# && apt-get install -y xvfb ./wkhtmltox_*.deb\
|
|
|
|
# && rm wkhtmltox_*.deb
|
2021-11-01 06:06:13 +00:00
|
|
|
|
|
|
|
COPY ./ /app/
|