From 0f3076387ab61c575e902e67b911d767a64f260e Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 17 Dec 2018 14:58:49 -0800 Subject: [PATCH] Set REPO_PATH as late as possible Leads to maximum cache re-use --- repo2docker/buildpacks/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repo2docker/buildpacks/base.py b/repo2docker/buildpacks/base.py index 005ef94d..1187bed2 100644 --- a/repo2docker/buildpacks/base.py +++ b/repo2docker/buildpacks/base.py @@ -38,15 +38,10 @@ ARG NB_UID ENV USER ${NB_USER} ENV HOME /home/${NB_USER} -# Allow target path repo is cloned to be configurable -ARG REPO_PATH=${HOME} -ENV REPO_PATH ${REPO_PATH} - RUN adduser --disabled-password \ --gecos "Default user" \ --uid ${NB_UID} \ ${NB_USER} -WORKDIR ${REPO_PATH} RUN wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ DISTRO="bionic" && \ @@ -102,6 +97,11 @@ COPY {{ src }} {{ dst }} {{sd}} {% endfor %} +# Allow target path repo is cloned to be configurable +ARG REPO_PATH=${HOME} +ENV REPO_PATH ${REPO_PATH} +WORKDIR ${REPO_PATH} + # Copy and chown stuff. This doubles the size of the repo, because # you can't actually copy as USER, only as root! Thanks, Docker! USER root