From 0fffbf8873ae372de6ba7a5ba600cc089431f360 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Sun, 1 Jan 2023 00:00:29 +0000 Subject: [PATCH] Revert "mount wheels from build stage instead of copying them" This reverts commit ed82b83ebad77d7c5893e23a73777de4812545dd. --- Dockerfile | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f7d08ed..9c28f765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,16 @@ # syntax = docker/dockerfile:1.3 ARG ALPINE_VERSION=3.16 -FROM alpine:${ALPINE_VERSION} AS builder +FROM alpine:${ALPINE_VERSION} RUN apk add --no-cache git python3 python3-dev py-pip build-base -# set pip's cache directory using this environment variable, and use -# ARG instead of ENV to ensure its only set when the image is built -ARG PIP_CACHE_DIR=/tmp/pip-cache - # build wheels in first image ADD . /tmp/src RUN cd /tmp/src && git clean -xfd && git status -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ - mkdir /tmp/wheelhouse \ +RUN mkdir /tmp/wheelhouse \ && cd /tmp/wheelhouse \ && pip3 install wheel \ - && pip3 wheel /tmp/src \ + && pip3 wheel --no-cache-dir /tmp/src \ && ls -l /tmp/wheelhouse FROM alpine:${ALPINE_VERSION} @@ -23,17 +18,12 @@ FROM alpine:${ALPINE_VERSION} # install python, git, bash, mercurial RUN apk add --no-cache git git-lfs python3 py-pip bash docker mercurial -# repeat ARG from above -ARG PIP_CACHE_DIR=/tmp/pip-cache +# install hg-evolve (Mercurial extensions) +RUN pip3 install hg-evolve --user --no-cache-dir # install repo2docker -# and hg-evolve (Mercurial extensions) -# mount /tmp/wheelhouse from build stage -# avoids extra layer when using COPY --from -RUN --mount=type=cache,target=${PIP_CACHE_DIR} \ - --mount=type=cache,from=builder,source=/tmp/wheelhouse,target=/tmp/wheelhouse \ - pip3 install --ignore-installed --no-deps /tmp/wheelhouse/*.whl \ - && pip3 install hg-evolve \ +COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse +RUN pip3 install --no-cache-dir --ignore-installed --no-deps /tmp/wheelhouse/*.whl \ && pip3 list # add git-credential helper