message stringlengths 5 481 | model_input stringlengths 47 2.9k | input_ids sequence | attention_mask sequence | labels sequence |
|---|---|---|---|---|
Succeed even if no requirements.txt is present
Will just get default jupyter installation + venv | MODIFY
ubuntu1610-python35-venv/s2i/bin/assemble
ubuntu1610-python35-venv/s2i/bin/assemble
@@ -23,4 +23,6 @@ echo "---> Installing application source..."
cp -Rf /tmp/src/. ./
echo "---> Building application from source..."
+if [ -f requirements.txt ]; then
${APP_DIR}/venv/bin/pip install --no-cache-dir -r requirements.txt
+fi
| [
1,
6720,
12096,
203,
373,
25348,
2313,
2163,
17,
8103,
4763,
17,
90,
3074,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
373,
25348,
2313,
2163,
17,
8103,
4763,
17,
90,
3074,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
30989,
300,
436... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
55,
5286,
5288,
5456,
309,
1158,
8433,
18,
5830,
353,
3430,
203,
13670,
2537,
336,
805,
525,
31341,
13193,
397,
25032,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Install git into base image | MODIFY
ubuntu1610-python35-venv/Dockerfile
ubuntu1610-python35-venv/Dockerfile
@@ -7,7 +7,7 @@ LABEL io.openshift.s2i.scripts-url=image:///usr/libexec/s2i
ENV APP_DIR /srv/app
RUN apt-get update
-RUN apt-get install --yes python3 python3-venv tar
+RUN apt-get install --yes python3 python3-venv tar git
RUN adduser --disabled-password --gecos "Default Jupyter user" jovyan
| [
1,
6720,
12096,
203,
373,
25348,
2313,
2163,
17,
8103,
4763,
17,
90,
3074,
19,
14174,
768,
203,
373,
25348,
2313,
2163,
17,
8103,
4763,
17,
90,
3074,
19,
14174,
768,
203,
30989,
300,
27,
16,
27,
397,
27,
16,
27,
22175,
18210,
2527... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
6410,
5071,
1368,
1026,
1316,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
Cleanup apt after installing things we want | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -6,9 +6,13 @@ LABEL io.openshift.s2i.scripts-url=image:///usr/libexec/s2i
ENV APP_DIR /srv/app
-RUN apt-get update
-RUN apt-get install --yes python3 python3-venv tar git
-
+RUN apt-get update && \
+ apt-get install --yes --no-install-recommends \
+ python3 \
+ python3-venv \
+ tar \
+ git && \
+ apt-get purge && apt-get clean
RUN adduser --disabled-password --gecos "Default Jupyter user" jovyan
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
26,
16,
29,
397,
26,
16,
3437,
22175,
18210,
2527,
18,
3190,
4012,
18,
87,
22,
77,
18,
12827,
17,
718,
33,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
15007,
279,
337,
1839,
3799,
310,
9198,
732,
2545,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
Set PATH to include the venv's bin | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -5,6 +5,7 @@ MAINTAINER Yuvi Panda <yuvipanda@gmail.com>
LABEL io.openshift.s2i.scripts-url=image:///usr/libexec/s2i
ENV APP_DIR /srv/app
+ENV PATH ${APP_DIR}/venv/bin:$PATH
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
25,
16,
26,
397,
25,
16,
27,
22175,
19316,
3217,
16843,
1624,
89,
522,
453,
464,
69,
411,
93,
89,
522,
84,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
694,
7767,
358,
2341,
326,
25032,
1807,
4158,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Pin versions of notebook & jupyterhub being installed | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -25,7 +25,7 @@ USER jovyan
RUN python3 -m venv venv
# FIXME: Specify actual versions here
-RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir jupyter jupyterhub
+RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2
COPY ./s2i/bin/ /usr/libexec/s2i
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
2947,
16,
27,
397,
2947,
16,
27,
22175,
7443,
525,
11699,
304,
203,
15238,
5790,
23,
300,
81,
25032,
25032,
203,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
12178,
5244,
434,
14718,
473,
525,
31341,
14986,
3832,
5876,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Cleanup the singleuser builder image | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -17,14 +17,13 @@ RUN apt-get update && \
RUN adduser --disabled-password --gecos "Default Jupyter user" jovyan
-RUN mkdir -p ${APP_DIR} && chown -R jovyan:jovyan /srv/app
+RUN mkdir -p ${APP_DIR} && chown -R jovyan:jovyan ${APP_DIR}
-WORKDIR ${APP_DIR}
+WORKDIR /home/jovyan
USER jovyan
-RUN python3 -m venv venv
+RUN python3 -m venv ${APP_DIR}/venv
-# FIXME: Specify actual versions here
RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2
COPY ./s2i/bin/ /usr/libexec/s2i
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
4033,
16,
3461,
397,
4033,
16,
3437,
22175,
15484,
279,
337,
17,
588,
1089,
597,
521,
203,
15238,
527,
1355,
1493... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
15007,
326,
2202,
1355,
2089,
1316,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
Make the makefile versioned + more useful | MODIFY
singleuser-builder/Makefile
singleuser-builder/Makefile
-IMAGE_NAME = ubuntu1610-python35-venv
+IMAGE_NAME = jupyterhub/singleuser-builder
+VERSION = $(shell cat version)
.PHONY: build
build:
- docker build -t $(IMAGE_NAME) .
+ docker build -t $(IMAGE_NAME):$(VERSION) .
.PHONY: test
test:
- docker build -t $(IMAGE_NAME)-candidate .
- IMAGE_NAME=$(IMAGE_NAME)-candidate test/run
+ docker build -t $(IMAGE_NAME)-candidate:$(VERSION) .
+ IMAGE_NAME=$(IMAGE_NAME)-candidate:$(VERSION) test/run
MODIFY
singleuser-builder/s2i/bin/assemble
singleuser-builder/s2i/bin/assemble
#!/bin/bash -e
#
-# S2I assemble script for the 'ubuntu1610-python35-venv' image.
+# S2I assemble script for the jupyterhub/singleuser-builder image.
# The 'assemble' script builds your application source so that it is ready to run.
#
# For more information refer to the documentation:
# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
#
-# If the 'ubuntu1610-python35-venv' assemble script is executed with the '-h' flag, print the usage.
if [[ "$1" == "-h" ]]; then
exec /usr/libexec/s2i/usage
fi
ADD
singleuser-builder/version
+v0.1
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
6464,
768,
203,
7526,
1355,
17,
9574,
19,
6464,
768,
203,
17,
13603,
67,
1985,
273,
13910,
25348,
2313,
2163,
17,
8103,
4763,
17,
90,
3074,
203,
15,
13603,
67,
1985,
273,
525,
31341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
6464,
326,
1221,
768,
17083,
397,
1898,
5301,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Install ipywidgets in base
I consider it part of base notebook install :) | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -24,7 +24,7 @@ WORKDIR /home/jovyan
USER jovyan
RUN python3 -m venv ${APP_DIR}/venv
-RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2
+RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2 ipywidgets==5.2.3
COPY ./s2i/bin/ /usr/libexec/s2i
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
3247,
16,
27,
397,
3247,
16,
27,
22175,
17062,
4537,
342,
8712,
19,
78,
11699,
304,
203,
4714,
525,
11699,
304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
6410,
277,
2074,
18148,
316,
1026,
203,
45,
5260,
518,
1087,
434,
1026,
14718,
3799,
294,
13,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
Cleanup assemble script to keep workspace clean | MODIFY
singleuser-builder/s2i/bin/assemble
singleuser-builder/s2i/bin/assemble
@@ -13,15 +13,11 @@ fi
# Restore artifacts from the previous build (if they exist).
#
-if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then
- echo "---> Restoring build artifacts..."
- mv /tmp/artifacts/. ./
-fi
-
echo "---> Installing application source..."
-cp -Rf /tmp/src/. ./
+mkdir -p ${APP_DIR}/src
+cp -Rf /tmp/src/. ${APP_DIR}/src
echo "---> Building application from source..."
-if [ -f requirements.txt ]; then
- ${APP_DIR}/venv/bin/pip install --no-cache-dir -r requirements.txt
+if [ -f ${APP_DIR}/src/requirements.txt ]; then
+ ${APP_DIR}/venv/bin/pip install --no-cache-dir -r ${APP_DIR}/src/requirements.txt
fi
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
7526,
1355,
17,
9574,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
30989,
300,
3437,
16,
3600,
397,
3437,
16,
2499,
22175,
7314,
203,
7,
11197,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
15007,
19540,
2728,
358,
3455,
6003,
2721,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Properly install ipywidgets in base image | MODIFY
singleuser-builder/Dockerfile
singleuser-builder/Dockerfile
@@ -24,7 +24,8 @@ WORKDIR /home/jovyan
USER jovyan
RUN python3 -m venv ${APP_DIR}/venv
-RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2 ipywidgets==5.2.3
+RUN ${APP_DIR}/venv/bin/pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2 ipywidgets==5.2.3 && \
+ ${APP_DIR}/venv/bin/jupyter nbextension enable --py widgetsnbextension
COPY ./s2i/bin/ /usr/libexec/s2i
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
19,
14174,
768,
203,
30989,
300,
3247,
16,
27,
397,
3247,
16,
28,
22175,
17062,
4537,
342,
8712,
19,
78,
11699,
304,
203,
4714,
525,
11699,
304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
626,
457,
715,
3799,
277,
2074,
18148,
316,
1026,
1316,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Copy github source into to working directory too
This is a hack to make sure that binder-like workflows work
ok | MODIFY
singleuser-builder/s2i/bin/assemble
singleuser-builder/s2i/bin/assemble
@@ -17,6 +17,10 @@ echo "---> Installing application source..."
mkdir -p ${APP_DIR}/src
cp -Rf /tmp/src/. ${APP_DIR}/src
+# HACK: We copy it to current directory too, since people wanna see the
+# notebooks and stuff in there. Figure out a way to tweak this?
+cp -Rf /tmp/src/. .
+
echo "---> Building application from source..."
if [ -f ${APP_DIR}/src/requirements.txt ]; then
${APP_DIR}/venv/bin/pip install --no-cache-dir -r ${APP_DIR}/src/requirements.txt
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
7526,
1355,
17,
9574,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
30989,
300,
4033,
16,
26,
397,
4033,
16,
2163,
22175,
3376,
5238,
2122,
10284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
2951,
6133,
1084,
1368,
358,
5960,
1867,
4885,
203,
2503,
353,
279,
11769,
358,
1221,
3071,
716,
18135,
17,
5625,
31738,
1440,
203,
601,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
try, fail and give up on getting miniconda to work
Someone else should do this :) | MODIFY
singleuser-builder-conda/Dockerfile
singleuser-builder-conda/Dockerfile
@@ -25,8 +25,9 @@ ADD install-miniconda.bash /usr/local/bin/install-miniconda.bash
RUN /usr/local/bin/install-miniconda.bash
USER $NB_USER
-RUN pip install --no-cache-dir notebook==5.0.0 jupyterhub==0.7.2 ipywidgets==5.2.3 && \
- jupyter nbextension enable --py widgetsnbextension
+ADD environment.yml .
+RUN conda env create --quiet -n base
+RUN rm environment.yml
COPY ./s2i/bin/ /usr/libexec/s2i
ADD
singleuser-builder-conda/environment.yml
+name: base
+dependencies:
+- notebook==5.0.0
+- ipykernel==4.6.0
+- ipywidgets==6.0.0
+- pip:
+ jupyterhub==0.7.2
MODIFY
singleuser-builder-conda/s2i/bin/assemble
singleuser-builder-conda/s2i/bin/assemble
@@ -19,7 +19,7 @@ cp -Rf /tmp/src/. .
echo "---> Building application from source..."
if [ -f environment.yml ]; then
- conda env update -f environment.yml
+ conda env update -n base -f environment.yml
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
MODIFY
singleuser-builder-conda/s2i/bin/run
singleuser-builder-conda/s2i/bin/run
# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
#
+source activate base
exec jupyter notebook --ip=0.0.0.0
MODIFY
singleuser-builder-conda/version
singleuser-builder-conda/version
-v0.1.1
+v0.1.3
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
14174,
768,
203,
30989,
300,
2947,
16,
28,
397,
2947,
16,
29,
22175,
11689,
3799,
17,
1154,
335,
1434,
69,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
698,
16,
2321,
471,
8492,
731,
603,
8742,
1131,
335,
1434,
69,
358,
1440,
203,
17358,
476,
469,
1410,
741,
333,
294,
13,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Fail and give up at getting miniconda working again | MODIFY
singleuser-builder-conda/Dockerfile
singleuser-builder-conda/Dockerfile
@@ -14,7 +14,7 @@ RUN apt-get update && \
apt-get purge && apt-get clean
ENV CONDA_DIR /opt/conda
-ENV PATH $CONDA_DIR/bin:$PATH
+ENV PATH $CONDA_DIR/envs/base/bin:$CONDA_DIR/bin/:$PATH
ENV NB_USER jovyan
RUN adduser --disabled-password --gecos "Default Jupyter user" ${NB_USER}
@@ -26,7 +26,7 @@ RUN /usr/local/bin/install-miniconda.bash
USER $NB_USER
ADD environment.yml .
-RUN conda env create --quiet -n base
+RUN conda env create --quiet -n base && conda clean -tipsy
RUN rm environment.yml
COPY ./s2i/bin/ /usr/libexec/s2i
MODIFY
singleuser-builder-conda/environment.yml
singleuser-builder-conda/environment.yml
@@ -4,4 +4,4 @@ dependencies:
- ipykernel==4.6.0
- ipywidgets==6.0.0
- pip:
- jupyterhub==0.7.2
+ - jupyterhub==0.7.2
MODIFY
singleuser-builder-conda/version
singleuser-builder-conda/version
-v0.1.3
+v0.1.4
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
14174,
768,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
14174,
768,
203,
30989,
300,
3461,
16,
27,
397,
3461,
16,
27,
22175,
15484,
279,
337,
17,
588,
1089,
597,
521,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
3754,
471,
8492,
731,
622,
8742,
1131,
335,
1434,
69,
5960,
3382,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Switch to an even older docker API version
This works with GKE which has Docker 1.11 | MODIFY
builder/app.py
builder/app.py
@@ -78,7 +78,7 @@ class Builder(Application):
if bp.detect(output_path):
bp.build(output_path, self.output_image_spec)
- client = docker.from_env(version='1.24')
+ client = docker.from_env(version='1.23')
for line in client.images.push(self.output_image_spec, stream=True):
progress = json.loads(line.decode('utf-8'))
print(progress['status'])
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
8285,
16,
27,
397,
8285,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
430,
9107,
18,
16518,
12,
2844,
67,
803,
4672,
203,
17152,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
10200,
358,
392,
5456,
12156,
6267,
1491,
1177,
203,
2503,
6330,
598,
611,
6859,
1492,
711,
9779,
404,
18,
2499,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Bump s2i builder images | MODIFY
builder/detectors.py
builder/detectors.py
@@ -22,8 +22,8 @@ class BuildPack(LoggingConfigurable):
class PythonBuildPack(BuildPack):
runtime_builder_map = Dict({
- 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.2',
- 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.2',
+ 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.3',
+ 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.3',
})
runtime = Unicode(
| [
1,
6720,
12096,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
30989,
300,
3787,
16,
28,
397,
3787,
16,
28,
22175,
667,
3998,
4420,
12,
7735,
31660,
4672,
203,
1106,
6600,
3116,
4420,
12,
3116,
4420... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
38,
2801,
272,
22,
77,
2089,
4602,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Print entire progress object
Should be moved into structlog soon | MODIFY
builder/app.py
builder/app.py
@@ -81,7 +81,7 @@ class Builder(Application):
client = docker.from_env(version='1.23')
for line in client.images.push(self.output_image_spec, stream=True):
progress = json.loads(line.decode('utf-8'))
- print(progress['status'])
+ print(progress)
if __name__ == '__main__':
f = Builder()
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
11861,
16,
27,
397,
11861,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
2625,
273,
6267,
18,
2080,
67,
3074,
12,
1589,
2218,
21,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
5108,
7278,
4007,
733,
203,
14309,
506,
10456,
1368,
1958,
1330,
17136,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
Update venv image version again
Should move these out to config soon | MODIFY
builder/detectors.py
builder/detectors.py
@@ -22,8 +22,8 @@ class BuildPack(LoggingConfigurable):
class PythonBuildPack(BuildPack):
runtime_builder_map = Dict({
- 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.3',
- 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.3',
+ 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.4',
+ 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.4',
})
runtime = Unicode(
| [
1,
6720,
12096,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
30989,
300,
3787,
16,
28,
397,
3787,
16,
28,
22175,
667,
3998,
4420,
12,
7735,
31660,
4672,
203,
1106,
6600,
3116,
4420,
12,
3116,
4420... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
1891,
25032,
1316,
1177,
3382,
203,
14309,
3635,
4259,
596,
358,
642,
17136,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Add a simple but fully functional Dockerfile | ADD
Dockerfile
+FROM ubuntu:16.10
+
+RUN apt-get update && \
+ apt-get install --yes --no-install-recommends \
+ curl \
+ python3 \
+ python3-pip \
+ python3-setuptools \
+ git && \
+ apt-get clean && apt-get purge
+
+COPY install-s2i.bash /usr/local/bin/install-s2i.bash
+RUN /usr/local/bin/install-s2i.bash
+
+RUN pip3 install --no-cache-dir git+https://github.com/yuvipanda/builder@e7d51c3
+
ADD
install-s2i.bash
+#!/bin/bash
+set -e
+
+cd /usr/local/bin/ && curl -L https://github.com/openshift/source-to-image/releases/download/v1.1.5/source-to-image-v1.1.5-4dd7721-linux-amd64.tar.gz | tar xvz
+
| [
1,
8355,
203,
203,
14174,
768,
203,
15,
11249,
13910,
25348,
30,
2313,
18,
2163,
203,
15,
203,
15,
15238,
279,
337,
17,
588,
1089,
597,
521,
203,
15,
279,
337,
17,
588,
3799,
1493,
9707,
1493,
2135,
17,
5425,
17,
26687,
5839,
521,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
986,
279,
4143,
1496,
7418,
18699,
9779,
768,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Add a dockerfile based BuildPack
Great escape hatch | MODIFY
builder/app.py
builder/app.py
@@ -9,7 +9,7 @@ import docker
import subprocess
-from .detectors import BuildPack, PythonBuildPack
+from .detectors import BuildPack, PythonBuildPack, DockerBuildPack
class Builder(Application):
config_file = Unicode(
@@ -42,7 +42,7 @@ class Builder(Application):
buildpacks = List(
None,
- [PythonBuildPack],
+ [DockerBuildPack, PythonBuildPack],
config=True
)
@@ -77,6 +77,10 @@ class Builder(Application):
bp = bp_class()
if bp.detect(output_path):
bp.build(output_path, self.output_image_spec)
+ break
+ else:
+ raise Exception("No compatible builders found")
+
client = docker.from_env(version='1.23')
for line in client.images.push(self.output_image_spec, stream=True):
MODIFY
builder/detectors.py
builder/detectors.py
import os
import subprocess
+import docker
+
from traitlets import Unicode, Dict
from traitlets.config import LoggingConfigurable
@@ -20,6 +22,21 @@ class BuildPack(LoggingConfigurable):
+class DockerBuildPack(BuildPack):
+ def detect(self, workdir):
+ return os.path.exists(os.path.join(workdir, 'Dockerfile'))
+
+ def build(self, workdir, output_image_spec):
+ client = docker.APIClient(base_url='unix://var/run/docker.sock', version='auto')
+ for progress in client.build(
+ path=workdir,
+ tag=output_image_spec,
+ decode=True
+ ):
+ # FIXME: Properly stream back useful information only
+ pass
+
+
class PythonBuildPack(BuildPack):
runtime_builder_map = Dict({
'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.4',
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
29,
16,
27,
397,
29,
16,
27,
22175,
1930,
6267,
203,
5666,
6652,
203,
17,
2080,
263,
8238,
18886,
1930,
3998,
4420,
16,
6600,
3116,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
986,
279,
6267,
768,
2511,
3998,
4420,
203,
43,
6150,
4114,
366,
505,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
Have Dockerfile build off current dir
Makes it much easier to test! | MODIFY
Dockerfile
Dockerfile
@@ -12,5 +12,7 @@ RUN apt-get update && \
COPY install-s2i.bash /usr/local/bin/install-s2i.bash
RUN /usr/local/bin/install-s2i.bash
-RUN pip3 install --no-cache-dir git+https://github.com/yuvipanda/builder@e7d51c3
+RUN mkdir /tmp/src
+ADD . /tmp/src
+RUN pip3 install /tmp/src
| [
1,
6720,
12096,
203,
14174,
768,
203,
14174,
768,
203,
30989,
300,
2138,
16,
25,
397,
2138,
16,
27,
22175,
15484,
279,
337,
17,
588,
1089,
597,
521,
203,
24875,
3799,
17,
87,
22,
77,
18,
28734,
342,
13640,
19,
3729,
19,
4757,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
17944,
9779,
768,
1361,
3397,
783,
1577,
203,
14534,
518,
9816,
15857,
358,
1842,
5,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Bump version of venv builders | MODIFY
builder/detectors.py
builder/detectors.py
@@ -39,8 +39,8 @@ class DockerBuildPack(BuildPack):
class PythonBuildPack(BuildPack):
runtime_builder_map = Dict({
- 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.4',
- 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.4',
+ 'python-2.7': 'jupyterhub/singleuser-builder-venv-2.7:v0.1.5',
+ 'python-3.5': 'jupyterhub/singleuser-builder-venv-3.5:v0.1.5',
})
runtime = Unicode(
| [
1,
6720,
12096,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
9574,
19,
8238,
18886,
18,
2074,
203,
30989,
300,
5520,
16,
28,
397,
5520,
16,
28,
22175,
667,
9779,
3116,
4420,
12,
3116,
4420,
4672,
203,
1106,
6600,
3116,
4420,
12,
3116,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
38,
2801,
1177,
434,
25032,
19916,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Do a hacky attempt at not rebuilding already-built images
This is such a complete and utter hack, and I should be somewhat
ashamed of myself. *However*, the docker registry API seems to be
a piece of poop, and there seem to be absolutely no client libraries
for it in python :( | MODIFY
builder/app.py
builder/app.py
@@ -67,6 +67,23 @@ class Builder(Application):
self.load_config_file(self.config_file)
def run(self):
+ # HACK: Try to just pull this and see if that works.
+ # if it does, then just bail.
+ # WHAT WE REALLY WANT IS TO NOT DO ANY WORK IF THE IMAGE EXISTS
+ client = docker.APIClient(base_url='unix://var/run/docker.sock', version='auto')
+
+ try:
+ repo, tag = self.output_image_spec.split(':')
+ for line in client.pull(
+ repository=repo,
+ tag=tag,
+ stream=True,
+ ):
+ print(json.loads(line.decode('utf-8')))
+ return
+ except docker.errors.ImageNotFound:
+ pass
+
output_path = os.path.join(self.git_workdir, self.build_name)
self.fetch(
self.source_url,
@@ -82,8 +99,7 @@ class Builder(Application):
raise Exception("No compatible builders found")
- client = docker.from_env(version='1.23')
- for line in client.images.push(self.output_image_spec, stream=True):
+ for line in client.push(self.output_image_spec, stream=True):
progress = json.loads(line.decode('utf-8'))
print(progress)
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
9599,
16,
26,
397,
9599,
16,
4366,
22175,
667,
5008,
12,
3208,
4672,
203,
2890,
18,
945,
67,
1425,
67,
768,
12,
2890,
18,
1425,
67,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
3244,
279,
11769,
93,
4395,
622,
486,
13419,
310,
1818,
17,
12406,
4602,
203,
2503,
353,
4123,
279,
3912,
471,
22963,
11769,
16,
471,
467,
1410,
506,
18016,
11304,
203,
961,
2808,
434,
3399,
2890,
18,
380,
44,
543,
6084,
14,
16,
... |
Actually check out the ref that is passed to builder
We weren't actually doing this earlier. boo | MODIFY
builder/app.py
builder/app.py
@@ -75,7 +75,7 @@ class Builder(Application):
sys.exit(1)
try:
- for line in execute_cmd(['git', '--git-dir', os.path.join(output_path, '.git'), 'checkout', ref]):
+ for line in execute_cmd(['git', '--git-dir', os.path.join(output_path, '.git'), 'reset', '--hard', ref]):
self.log.info(line, extra=dict(phase='fetching'))
except subprocess.CalledProcessError:
self.log.error('Failed to check out ref %s', ref, extra=dict(phase='failed'))
@@ -113,7 +113,7 @@ class Builder(Application):
output_path = os.path.join(self.git_workdir, self.build_name)
self.fetch(
self.source_url,
- 'master',
+ self.source_ref,
output_path
)
for bp_class in self.buildpacks:
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
5877,
16,
27,
397,
5877,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
9499,
18,
8593,
12,
21,
13,
203,
698,
30,
203,
17,
364,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
2459,
3452,
866,
596,
326,
1278,
716,
353,
2275,
358,
2089,
203,
3218,
22646,
275,
1404,
6013,
9957,
333,
13805,
18,
800,
83,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
cleanup after installing in assemble step | MODIFY
singleuser-builder-conda/s2i/bin/assemble
singleuser-builder-conda/s2i/bin/assemble
@@ -20,6 +20,7 @@ cp -Rf /tmp/src/. .
echo "---> Building application from source..."
if [ -f environment.yml ]; then
conda env update -n root -f environment.yml
+ conda clean -tipsy
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
| [
1,
6720,
12096,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
7526,
1355,
17,
9574,
17,
591,
2414,
19,
87,
22,
77,
19,
4757,
19,
29676,
203,
30989,
300,
3462,
16,
26,
397,
3462,
16,
27,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
16732,
1839,
3799,
310,
316,
19540,
2235,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
launch docker with kwargs_from_env
respects DOCKER_HOST, etc. | MODIFY
builder/app.py
builder/app.py
@@ -9,6 +9,7 @@ from pythonjsonlogger import jsonlogger
from traitlets.config import Application, LoggingConfigurable, Unicode, Dict, List
from traitlets import Type
import docker
+from docker.utils import kwargs_from_env
import subprocess
@@ -96,7 +97,7 @@ class Builder(Application):
# HACK: Try to just pull this and see if that works.
# if it does, then just bail.
# WHAT WE REALLY WANT IS TO NOT DO ANY WORK IF THE IMAGE EXISTS
- client = docker.APIClient(base_url='unix://var/run/docker.sock', version='auto')
+ client = docker.APIClient(version='auto', **kwargs_from_env())
repo, tag = self.output_image_spec.split(':')
for line in client.pull(
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
29,
16,
26,
397,
29,
16,
27,
22175,
628,
5790,
1977,
4901,
1930,
1163,
4901,
203,
2080,
13517,
17307,
18,
1425,
1930,
4257,
16,
10253,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
20738,
6267,
598,
1205,
67,
2080,
67,
3074,
203,
455,
1181,
87,
5467,
3507,
654,
67,
8908,
16,
5527,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
catch ImageNotFound on initial pull | MODIFY
builder/app.py
builder/app.py
@@ -100,6 +100,7 @@ class Builder(Application):
client = docker.APIClient(version='auto', **kwargs_from_env())
repo, tag = self.output_image_spec.split(':')
+ try:
for line in client.pull(
repository=repo,
tag=tag,
@@ -110,6 +111,8 @@ class Builder(Application):
break
else:
return
+ except docker.errors.ImageNotFound:
+ pass
output_path = os.path.join(self.git_workdir, self.build_name)
self.fetch(
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
6625,
16,
26,
397,
6625,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
2625,
273,
6267,
18,
31671,
12,
1589,
2218,
6079,
2187,
2826,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
14683,
3421,
2768,
603,
2172,
6892,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
comments for pull cases | MODIFY
builder/app.py
builder/app.py
@@ -108,10 +108,13 @@ class Builder(Application):
):
progress = json.loads(line.decode('utf-8'))
if 'error' in progress:
+ # pull failed, proceed to build
break
else:
+ # image exists, nothing to build
return
except docker.errors.ImageNotFound:
+ # image not found, proceed to build
pass
output_path = os.path.join(self.git_workdir, self.build_name)
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
21770,
16,
2163,
397,
21770,
16,
3437,
22175,
667,
5008,
12,
3208,
4672,
203,
4672,
203,
8298,
273,
1163,
18,
17135,
12,
1369,
18,
3922,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
9231,
364,
6892,
6088,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Make sure that the cleanup is actually conditional | MODIFY
builder/app.py
builder/app.py
@@ -69,6 +69,7 @@ class Builder(Application):
'source': 'Builder.source_url',
'ref': 'Builder.source_ref',
'output': 'Builder.output_image_spec',
+ 'clean': 'Builder.cleanup_checkout',
'f': 'Builder.config_file',
})
@@ -155,6 +156,7 @@ class Builder(Application):
self.log.info('Pushing image', extra=dict(progress=layers, phase='pushing'))
last_emit_time = time.time()
+ if self.cleanup_checkout:
shutil.rmtree(output_path)
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
8148,
16,
26,
397,
8148,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
1807,
552,
4278,
296,
1263,
18,
3168,
67,
718,
2187,
203,
4565,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
6464,
3071,
716,
326,
6686,
353,
6013,
11139,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Use cwd switching to do git operations
Setting just --git-dir is not enough, you also need to set
work-dir. Just setting cwd is better | MODIFY
builder/app.py
builder/app.py
@@ -83,7 +83,7 @@ class Builder(Application):
sys.exit(1)
try:
- for line in execute_cmd(['git', '--git-dir', os.path.join(output_path, '.git'), 'reset', '--hard', ref]):
+ for line in execute_cmd(['git', 'reset', '--hard', ref], output_path):
self.log.info(line, extra=dict(phase='fetching'))
except subprocess.CalledProcessError:
self.log.error('Failed to check out ref %s', ref, extra=dict(phase='failed'))
MODIFY
builder/detectors.py
builder/detectors.py
@@ -65,12 +65,12 @@ class S2IBuildPack(BuildPack):
'build',
'--exclude', '""',
'--ref', ref,
- workdir,
+ '.',
build_image,
output_image_spec,
]
try:
- for line in execute_cmd(cmd):
+ for line in execute_cmd(cmd, cwd=workdir):
self.log.info(line, extra=dict(phase='building', builder=self.name))
except subprocess.CalledProcessError:
self.log.error('Failed to build image!', extra=dict(phase='failed'))
MODIFY
builder/utils.py
builder/utils.py
import subprocess
-def execute_cmd(cmd):
+def execute_cmd(cmd, cwd=None):
"""
Call given command, yielding output line by line
"""
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, cwd=cwd)
try:
for line in iter(proc.stdout.readline, ''):
| [
1,
6720,
12096,
203,
9574,
19,
2910,
18,
2074,
203,
9574,
19,
2910,
18,
2074,
203,
30989,
300,
10261,
16,
27,
397,
10261,
16,
27,
22175,
667,
5008,
12,
3208,
4672,
203,
9499,
18,
8593,
12,
21,
13,
203,
698,
30,
203,
17,
364,
980... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
3727,
7239,
30882,
358,
741,
5071,
5295,
203,
5568,
2537,
1493,
6845,
17,
1214,
353,
486,
7304,
16,
1846,
2546,
1608,
358,
444,
203,
1252,
17,
1214,
18,
12526,
3637,
7239,
353,
7844,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Upgrade version of s2i | MODIFY
install-s2i.bash
install-s2i.bash
#!/bin/bash
set -e
-cd /usr/local/bin/ && curl -L https://github.com/openshift/source-to-image/releases/download/v1.1.5/source-to-image-v1.1.5-4dd7721-linux-amd64.tar.gz | tar xvz
+cd /usr/local/bin/ && curl -L https://github.com/openshift/source-to-image/releases/download/v1.1.6/source-to-image-v1.1.6-f519129-linux-amd64.tar.gz | tar xvz
| [
1,
6720,
12096,
203,
5425,
17,
87,
22,
77,
18,
28734,
203,
5425,
17,
87,
22,
77,
18,
28734,
203,
7,
5,
19,
4757,
19,
28734,
203,
542,
300,
73,
203,
17,
4315,
342,
13640,
19,
3729,
19,
4757,
19,
597,
3363,
300,
48,
2333,
2207,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
10784,
1177,
434,
272,
22,
77,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Add a simple README | ADD
README.md
+## Builder
+
+**Note*: The project will probably be renamed soon!
+
+A simple commandline tool that builds a docker image off a git repository & pushes it to a repo.
+
+It mostly relies on other tools ([Source to Image](https://github.com/openshift/source-to-image) or just docker)
+for doing the actual building. It is a simple wrapper that does detection to figure out which
+build method to use, and how to invoke that build method.
| [
1,
8355,
203,
203,
6949,
958,
18,
1264,
203,
15,
1189,
5008,
203,
15,
203,
15,
636,
8067,
14,
30,
1021,
1984,
903,
8656,
506,
17657,
17136,
5,
203,
15,
203,
15,
37,
4143,
28305,
5226,
716,
10736,
279,
6267,
1316,
3397,
279,
5071,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
986,
279,
4143,
10746,
958,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Remove .gitignore in anticipation of merging with s2i | DELETE
.gitignore
-node_modules
-*.py[co]
-*~
-.cache
-.DS_Store
-build
-dist
-docs/_build
-docs/source/_static/rest-api
-.ipynb_checkpoints
-# ignore config file at the top-level of the repo
-# but not sub-dirs
-/jupyterhub_config.py
-jupyterhub_cookie_secret
-jupyterhub.sqlite
-share/jupyter/hub/static/components
-share/jupyter/hub/static/css/style.min.css
-share/jupyter/hub/static/css/style.min.css.map
-*.egg-info
-MANIFEST
-.coverage
-htmlcov
-bin/
-lib/
-include/
-share/
| [
1,
6460,
203,
18,
6845,
6185,
203,
203,
17,
2159,
67,
6400,
203,
17,
11146,
2074,
63,
2894,
65,
203,
17,
14,
98,
203,
17,
18,
2493,
203,
17,
18,
3948,
67,
2257,
203,
17,
3510,
203,
17,
4413,
203,
17,
8532,
18510,
3510,
203,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
3288,
263,
6845,
6185,
316,
17841,
24629,
367,
434,
17256,
598,
272,
22,
77,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Rename builder to repo2docker
Package name is jupyter-repo2docker | RENAME
builder/__init__.py
repo2docker/__init__.py
RENAME
builder/app.py
repo2docker/app.py
@@ -19,9 +19,9 @@ from .detectors import BuildPack, PythonBuildPack, DockerBuildPack, CondaBuildPa
from .utils import execute_cmd
-class Builder(Application):
+class Repo2Docker(Application):
config_file = Unicode(
- 'builder_config.py',
+ 'repo2docker_config.py',
config=True
)
@@ -66,11 +66,11 @@ class Builder(Application):
)
aliases = Dict({
- 'source': 'Builder.source_url',
- 'ref': 'Builder.source_ref',
- 'output': 'Builder.output_image_spec',
- 'clean': 'Builder.cleanup_checkout',
- 'f': 'Builder.config_file',
+ 'source': 'Repo2Docker.source_url',
+ 'ref': 'Repo2Docker.source_ref',
+ 'output': 'Repo2Docker.output_image_spec',
+ 'clean': 'Repo2Docker.cleanup_checkout',
+ 'f': 'Repo2Docker.config_file',
})
@@ -161,6 +161,6 @@ class Builder(Application):
if __name__ == '__main__':
- f = Builder()
+ f = Repo2Docker()
f.initialize()
f.run()
RENAME
builder/detectors.py
repo2docker/detectors.py
RENAME
builder/utils.py
repo2docker/utils.py
MODIFY
setup.py
setup.py
from setuptools import setup, find_packages
setup(
- name='builder',
+ name='jupyter-repo2docker',
version='0.1',
install_requires=[
'docker',
| [
1,
862,
1985,
203,
9574,
19,
972,
2738,
25648,
2074,
203,
7422,
22,
13660,
19,
972,
2738,
25648,
2074,
203,
203,
203,
862,
1985,
203,
9574,
19,
2910,
18,
2074,
203,
7422,
22,
13660,
19,
2910,
18,
2074,
203,
30989,
300,
3657,
16,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
16019,
2089,
358,
3538,
22,
13660,
203,
2261,
508,
353,
525,
31341,
17,
7422,
22,
13660,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
End of preview. Expand
in Data Studio
- Downloads last month
- 6