From 0e2349fdec843808d65a1db6ef2a16df216c220e Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 6 Sep 2019 12:26:56 +0200 Subject: [PATCH 1/2] avoid dirty in repo2docker version in docker image by calling git clean --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ab7498f..f1d8eace 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,12 @@ RUN apk add --no-cache git python3 python3-dev # build wheels in first image ADD . /tmp/src +RUN cd /tmp/src && git clean -xfd && git status RUN mkdir /tmp/wheelhouse \ && cd /tmp/wheelhouse \ && pip3 install wheel \ - && pip3 wheel --no-cache-dir /tmp/src + && pip3 wheel --no-cache-dir /tmp/src \ + && ls -l /tmp/wheelhouse FROM alpine:${ALPINE_VERSION} @@ -17,7 +19,8 @@ RUN apk add --no-cache git git-lfs python3 bash # install repo2docker COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse -RUN pip3 install --no-cache-dir /tmp/wheelhouse/*.whl +RUN pip3 install --no-cache-dir /tmp/wheelhouse/*.whl \ + && pip3 list # add git-credential helper COPY ./docker/git-credential-env /usr/local/bin/git-credential-env From 3cc3aa49688b250d28e8455a6dd602e87b73cd45 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 6 Sep 2019 12:28:12 +0200 Subject: [PATCH 2/2] use repo2docker version in docker tags docker tags will include versioneer tag, e.g. `0.10.0-4.abc123` where - 0.10.0 is the latest tag - 4 is the number of commits since then - abc123 is the current commit hash --- hooks/post_push | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hooks/post_push b/hooks/post_push index 3f7f7a9e..a2b89246 100644 --- a/hooks/post_push +++ b/hooks/post_push @@ -1,7 +1,8 @@ #!/bin/bash -# when building jupyter/repo2docker:master also push jupyter/repo2docker:abcd1234 - -HASH_IMAGE="$DOCKER_REPO:${SOURCE_COMMIT:0:8}" -docker tag $DOCKER_REPO:$DOCKER_TAG $HASH_IMAGE -docker push $HASH_IMAGE +# when building jupyter/repo2docker:master +# also push jupyter/repo2docker:1.2.3-3.abcd1234 (replace + with -) +version=$(docker run $DOCKER_REPO:$DOCKER_TAG jupyter-repo2docker --version | sed s@+@-@) +VERSION_IMAGE="$DOCKER_REPO:$version" +docker tag $DOCKER_REPO:$DOCKER_TAG "$VERSION_IMAGE" +docker push "$VERSION_IMAGE"