-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
38 lines (23 loc) · 872 Bytes
/
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.12 as requirements_stage
WORKDIR /wheel
RUN python -m pip install --user pipx
COPY ./pyproject.toml \
./requirements.txt \
/wheel/
RUN python -m pip wheel --wheel-dir=/wheel --no-cache-dir --requirement ./requirements.txt
RUN python -m pipx run --no-cache nb-cli generate -f /tmp/bot.py
FROM python:3.12-slim
WORKDIR /app
ENV TZ Asia/Shanghai
ENV PYTHONPATH=/app
COPY ./docker/gunicorn_conf.py ./docker/start.sh /
RUN chmod +x /start.sh
ENV APP_MODULE _main:app
ENV MAX_WORKERS 1
COPY --from=requirements_stage /tmp/bot.py /app
COPY ./docker/_main.py /app
COPY --from=requirements_stage /wheel /wheel
RUN pip install --no-cache-dir gunicorn uvicorn[standard] nonebot2 \
&& pip install --no-cache-dir --no-index --force-reinstall --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel && mkdir data
COPY . /app/
CMD ["/start.sh"]