-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (19 loc) · 787 Bytes
/
Dockerfile
File metadata and controls
36 lines (19 loc) · 787 Bytes
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
FROM python:3.8 as requirements_stage
WORKDIR /wheel
RUN python -m pip install --user pipx
COPY ./pyproject.toml \
./requirements.txt \
/wheel/
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
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.8-slim
WORKDIR /app
ENV TZ Asia/Shanghai
ENV PYTHONPATH=/app
COPY --from=requirements_stage /tmp/bot.py /app
COPY --from=requirements_stage /wheel /wheel
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install --no-cache-dir --no-index --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel
COPY . /app/
CMD ["python", "bot.py"]