Hi all,
I follow instructions from here https://circleci.com/docs/docker/ and here https://devcenter.heroku.com/articles/container-registry-and-runtime to build Docker image in CircleCI and push it to Heroku.
All looks ok, build and push is successful but application doesn’t work with error:
2017-02-16T18:21:34.017473+00:00 heroku[web.1]: Starting process with command `/bin/sh -c jupyter\ notebook\ --config\=./nb_config.py`
2017-02-16T18:21:37.595838+00:00 app[web.1]: [I 18:21:37.595 NotebookApp] Writing notebook server cookie secret to /var/src/dl-extensions/.local/share/jupyter/runtime/notebook_cookie_secret
2017-02-16T18:21:37.655855+00:00 app[web.1]: [W 18:21:37.655 NotebookApp] Error loading server extension dl_extensions
2017-02-16T18:21:37.655857+00:00 app[web.1]: Traceback (most recent call last):
2017-02-16T18:21:37.655858+00:00 app[web.1]: File "/usr/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1117, in init_server_extensions
2017-02-16T18:21:37.655859+00:00 app[web.1]: mod = importlib.import_module(modulename)
2017-02-16T18:21:37.655860+00:00 app[web.1]: File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
2017-02-16T18:21:37.655861+00:00 app[web.1]: __import__(name)
2017-02-16T18:21:37.655861+00:00 app[web.1]: ImportError: No module named dl_extensions
2017-02-16T18:21:37.659099+00:00 app[web.1]: [I 18:21:37.658 NotebookApp] Serving notebooks from local directory: /var/src/dl-extensions/tmp
2017-02-16T18:21:37.659246+00:00 app[web.1]: [I 18:21:37.659 NotebookApp] 0 active kernels
Now the trick, pull the deployed image from Heroku:
sudo docker pull registry.heroku.com/dl-extensions/web
Using default tag: latest
latest: Pulling from dl-extensions/web
5040bd298390: Already exists
fce5728aad85: Already exists
76610ec20bf5: Already exists
9c1bc3c30371: Already exists
e4b99677d005: Already exists
e683c1e75619: Already exists
eed00108881a: Already exists
a3ed95caeb02: Pull complete
4ff7cd81de44: Already exists
aa64f118f026: Already exists
30e6ad0053e1: Already exists
7daff0d2f585: Already exists
cdd95bb12ea0: Pull complete
693de087fbbd: Pull complete
Digest: sha256:b6c86f0e6d91e7119d68618f64f171abd07a73186fbcdc7e3561064c8ca79d33
Status: Downloaded newer image for registry.heroku.com/dl-extensions/web:latest
And push the absolutely same image back:
sudo docker push registry.heroku.com/dl-extensions/web
The push refers to a repository [registry.heroku.com/dl-extensions/web]
d2b6fb5bb48a: Layer already exists
5f70bf18a086: Layer already exists
0ef70e0491a2: Layer already exists
44500f63ff93: Layer already exists
9414ba5a4de8: Layer already exists
9c9716b0fd6c: Layer already exists
8080d9fd0213: Layer already exists
1e0ea159a3a9: Layer already exists
46d1cfdcff17: Layer already exists
bd7dcb3e1bc1: Layer already exists
98816c9818bb: Layer already exists
30339f20ced0: Layer already exists
0eb22bfb707d: Layer already exists
a2ae92ffcd29: Layer already exists
latest: digest: sha256:a600b8a3a0e031684a596026717a0b2fc65a9a777716ccfc6443b1513bb4090e size: 4510
Pay attention all layers exists this is exactly the same image. And now… all works!
2017-02-16T18:30:24.730043+00:00 heroku[web.1]: Starting process with command `/bin/sh -c jupyter\ notebook\ --config\=./nb_config.py`
2017-02-16T18:30:27.130158+00:00 app[web.1]: [I 18:30:27.129 NotebookApp] Writing notebook server cookie secret to /var/src/dl-extensions/.local/share/jupyter/runtime/notebook_cookie_secret
2017-02-16T18:30:27.172045+00:00 app[web.1]: [I 18:30:27.171 NotebookApp] Loaded dl_extensions
2017-02-16T18:30:27.175213+00:00 app[web.1]: [I 18:30:27.175 NotebookApp] Serving notebooks from local directory: /var/src/dl-extensions/tmp
I have been fighting with this issue about 3 days.
There is circle.yml:
machine:
services:
- docker
dependencies:
override:
- docker info
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build --rm=false -t mycompany/dl-extensions .
test:
override:
- docker run -d -p 8888:8888 mycompany/dl-extensions
- curl --retry 10 --retry-delay 5 -v http://localhost:8888
deployment:
hub:
branch: continious-deployable
commands:
# Push image to Docker Hub
- docker push mycompany/dl-extensions
# Push image to Heroku
- docker login --email=_ --username=_ --password=$HEROKU_API_KEY registry.heroku.com
- docker tag mycompany/dl-extensions registry.heroku.com/dl-extensions/web
- docker push registry.heroku.com/dl-extensions/web
Dockerfile
FROM mycompany/deeplearn-models
ENV WORKDIR /var/src/dl-extensions
COPY . $WORKDIR
WORKDIR $WORKDIR
RUN pip install --no-cache-dir -r requirements.txt && \
python setup.py bdist_egg && \
easy_install $WORKDIR/dist/dl_extensions-*py2.*.egg && \
jupyter nbextension install --py dl_extensions --sys-prefix && \
jupyter nbextension enable --py dl_extensions --sys-prefix && \
jupyter serverextension enable --py dl_extensions --sys-prefix && \
jupyter nbextension enable --py widgetsnbextension --sys-prefix && \
jupyter nbextension install --py fileupload && \
jupyter nbextension enable --py fileupload