A tool for building Docker images for Civis Platform Jupyter notebooks
Project description
civis-jupyter-notebook
A tool to enable any Docker image to be used with Civis Platform Jupyter notebooks.
Usage
In your Dockerfile
, put the following code at the end:
ENV DEFAULT_KERNEL=<your kernel> # set to python3 or ir
RUN pip install civis-jupyter-notebook && \
civis-jupyter-notebooks-install
# Add Tini
ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
EXPOSE 8888
WORKDIR /root/work
ENTRYPOINT ["/tini", "--"]
CMD ["civis-jupyter-notebooks-start"]
Here you need to replace <your kernel>
with the name of your kernel (e.g.,
python3
or ir
). Note that your Dockerfile must use
root
as the default user.
See the example Docker image for more details.
Integration Testing Docker Images with Civis Platform
If you would like to test your image's integration with Civis Platform locally follow the steps below:
- Create a notebook in your Civis Platform account and grab the ID of the notebook. This ID is the number
that appears at the end of the URL for the notebook,
https://platform.civisanalytics.com/#/notebooks/<NOTEBOOK ID>
. - Create an environment file called
my.env
and add the following to it:
PLATFORM_OBJECT_ID=<NOTEBOOK ID>
CIVIS_API_KEY=<YOUR CIVIS API KEY>
- Build your image locally:
docker build -t test .
. - Run the container:
docker run --rm -p 8888:8888 --env-file my.env test
. - Access the notebook at the ip of your Docker host with port 8888 (e.g.,
http://localhost:8888/notebooks/notebook.ipynb
).
Integration Testing Code Changes with Civis Platform
The scripts tests/build_dev_image.sh and tests/run_dev_image.sh can be used to test the integration of code changes with Civis Platform.
From the top directory in the repo type:
./tests/build_dev_image.sh
./tests/run_dev_image.sh <NOTEBOOK ID>
where <NOTEBOOK ID>
is the ID of a Civis Platform notebook. See step 1 above if you do not
have a notebook ID. Then you can connect to the notebook from your local browser and check
to make sure it is working properly.
Contributing
See CONTRIBUTING.md
for information about contributing to this project.
License
BSD-3
See LICENSE.txt for details.
The file terminal.js contains code from jupyter/nbclassic. As noted in the file, that code is Copyright (c) Jupyter Development Team and has a BSD-3 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file civis_jupyter_notebook-2.2.1.tar.gz
.
File metadata
- Download URL: civis_jupyter_notebook-2.2.1.tar.gz
- Upload date:
- Size: 83.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abd49283dfe12aa3e79661c3c60740af60591235277d51078522dc6ddd839819 |
|
MD5 | 2a193bf76f96b01c4bbf056023fa8e40 |
|
BLAKE2b-256 | 754b737db8aac8b43c288a901e676ddd714d674bf5be35e251b379cd50f339fa |
File details
Details for the file civis_jupyter_notebook-2.2.1-py3-none-any.whl
.
File metadata
- Download URL: civis_jupyter_notebook-2.2.1-py3-none-any.whl
- Upload date:
- Size: 84.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f46357fd7f9cb099d6e08ba4c502a1bf0e3acb6abe5cb5e706da2ff0043d2796 |
|
MD5 | 33568fd97e4c50e66651754062b82a80 |
|
BLAKE2b-256 | 82dbfc450693aeba8946af3e6c883c0bb3dbed8b1a7a67386f44f2536a447970 |