This project was created to prove if an anaconda-project
could be used to serve up a trusted jupyter
notebook via
a docker container.
This container should be used as the base from which anaconda-project
files will serve up trusted notebooks
on a local workstation or to a remote orchestration service such as kubernetes
or the AWS Elastic Container Service
(ECS).
The notebook will be reachable on port 8443
over https
.
The anaconda-project
file must include two commands
default
for running the notebook itselftrust
so that the notebook can run as a trusted notebook
Example anaconda-project
file
# ...
commands:
default:
notebook: notebook.ipynb
env_spec: default
trust:
unix: jupyter trust notebook.ipynb
env_spec: default
# ...
The anaconda-project
docker file will need to include the following in order to serve up desired content
FROM amcgrath/ap-notebook-base
# Copy the notebook and supporting libraries
# Make use of a .dockerignore file to filter unnecessary content
COPY --chown=anaconda:anaconda . /opt/project/
# install all of the dependencies for the project
RUN /opt/conda/bin/conda run -n project anaconda-project prepare --directory /opt/project \
&& /opt/conda/bin/conda clean --all -y
# trust the notebook
RUN /opt/conda/bin/conda run -n project anaconda-project run \
--directory /opt/project trust
The above example is an excerpt from the dockerfile in andrew-mcgrath/ap-trusted-notebook.
To build the container image, simply execute a standard docker build command.
export IMAGE_NAME="amcgrath/ap-baseline"
docker build \
--build-arg VCS_REF=$(git rev-parse --short HEAD) \
--build-arg BUILD_DATE=$(date -u +”%Y-%m-%dT%H:%M:%SZ”) \
--build-arg BUILD_VERSION=$(git describe --tags --dirty) \
-t $IMAGE_NAME .