|
1 | 1 | FROM python:3.11-slim-bullseye as stage-build |
2 | 2 | ARG TARGETARCH |
3 | | -ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple |
4 | | -ARG APT_MIRROR=http://mirrors.ustc.edu.cn |
5 | 3 |
|
6 | | -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=applets \ |
7 | | - sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \ |
8 | | - && rm -f /etc/cron.daily/apt-compat \ |
9 | | - && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ |
| 4 | +ARG DEPENDENCIES=" \ |
| 5 | + ca-certificates \ |
| 6 | + curl \ |
| 7 | + wget \ |
| 8 | + zip" |
| 9 | + |
| 10 | +ARG APT_MIRROR=http://mirrors.ustc.edu.cn |
| 11 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 12 | + --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 13 | + set -ex \ |
| 14 | + && rm -f /etc/apt/apt.conf.d/docker-clean \ |
| 15 | + && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \ |
| 16 | + && sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \ |
10 | 17 | && apt-get update \ |
11 | | - && apt-get install -y --no-install-recommends wget zip \ |
12 | | - && echo "no" | dpkg-reconfigure dash \ |
13 | | - && rm -rf /var/lib/apt/lists/* |
| 18 | + && apt-get -y install --no-install-recommends ${DEPENDENCIES} \ |
| 19 | + && echo "no" | dpkg-reconfigure dash |
14 | 20 |
|
15 | 21 | WORKDIR /opt/applets |
16 | | -COPY requirements.txt requirements.txt |
17 | 22 |
|
18 | | -RUN --mount=type=cache,target=/root/.cache/pip \ |
| 23 | +ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple |
| 24 | +RUN --mount=type=cache,target=/root/.cache,sharing=locked,id=applets \ |
| 25 | + --mount=type=bind,source=requirements.txt,target=requirements.txt \ |
19 | 26 | set -ex \ |
20 | 27 | && mkdir pip_packages build \ |
21 | 28 | && pip config set global.index-url ${PIP_MIRROR} \ |
22 | | - && pip download --only-binary=:all: \ |
23 | | - -d pip_packages \ |
24 | | - --platform win_amd64 \ |
25 | | - --python-version 3.11.6 --abi cp311 -r requirements.txt -i${PIP_MIRROR} \ |
| 29 | + && pip download \ |
| 30 | + --only-binary=:all: --platform win_amd64 \ |
| 31 | + --python-version 3.11.6 --abi cp311 \ |
| 32 | + -d pip_packages -r requirements.txt -i${PIP_MIRROR} \ |
26 | 33 | && cp requirements.txt pip_packages \ |
27 | 34 | && zip -r pip_packages.zip pip_packages \ |
28 | 35 | && mv pip_packages.zip build |
|
0 commit comments