|
1 | 1 | # syntax = docker/dockerfile:1.3
|
2 | 2 | ARG ALPINE_VERSION=3.16
|
3 |
| -FROM alpine:${ALPINE_VERSION} AS builder |
| 3 | +FROM alpine:${ALPINE_VERSION} |
4 | 4 |
|
5 | 5 | RUN apk add --no-cache git python3 python3-dev py-pip build-base
|
6 | 6 |
|
7 |
| -# set pip's cache directory using this environment variable, and use |
8 |
| -# ARG instead of ENV to ensure its only set when the image is built |
9 |
| -ARG PIP_CACHE_DIR=/tmp/pip-cache |
10 |
| - |
11 | 7 | # build wheels in first image
|
12 | 8 | ADD . /tmp/src
|
13 | 9 | RUN cd /tmp/src && git clean -xfd && git status
|
14 |
| -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ |
15 |
| - mkdir /tmp/wheelhouse \ |
| 10 | +RUN mkdir /tmp/wheelhouse \ |
16 | 11 | && cd /tmp/wheelhouse \
|
17 | 12 | && pip3 install wheel \
|
18 |
| - && pip3 wheel /tmp/src \ |
| 13 | + && pip3 wheel --no-cache-dir /tmp/src \ |
19 | 14 | && ls -l /tmp/wheelhouse
|
20 | 15 |
|
21 | 16 | FROM alpine:${ALPINE_VERSION}
|
22 | 17 |
|
23 | 18 | # install python, git, bash, mercurial
|
24 | 19 | RUN apk add --no-cache git git-lfs python3 py-pip bash docker mercurial
|
25 | 20 |
|
26 |
| -# repeat ARG from above |
27 |
| -ARG PIP_CACHE_DIR=/tmp/pip-cache |
| 21 | +# install hg-evolve (Mercurial extensions) |
| 22 | +RUN pip3 install hg-evolve --user --no-cache-dir |
28 | 23 |
|
29 | 24 | # install repo2docker
|
30 |
| -# and hg-evolve (Mercurial extensions) |
31 |
| -# mount /tmp/wheelhouse from build stage |
32 |
| -# avoids extra layer when using COPY --from |
33 |
| -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ |
34 |
| - --mount=type=cache,from=builder,source=/tmp/wheelhouse,target=/tmp/wheelhouse \ |
35 |
| - pip3 install --ignore-installed --no-deps /tmp/wheelhouse/*.whl \ |
36 |
| - && pip3 install hg-evolve \ |
| 25 | +COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse |
| 26 | +RUN pip3 install --no-cache-dir --ignore-installed --no-deps /tmp/wheelhouse/*.whl \ |
37 | 27 | && pip3 list
|
38 | 28 |
|
39 | 29 | # add git-credential helper
|
|
0 commit comments