Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
feat: Consolidate role-base images (#21)
Browse files Browse the repository at this point in the history
- Creates illumidesk/base-notebook image with repo2docker
- Updates illumidesk/illumidesk-notebook image so that's its compatible with the standard jupyter/docker-stacks images
- Adds nbgrader extensions using before-notebook start hook
  • Loading branch information
jgwerner authored Aug 24, 2020
1 parent 082227d commit 552ec6a
Show file tree
Hide file tree
Showing 43 changed files with 1,980 additions and 718 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# F403: import *
# F811: redefinition of unused `name` from line `N`
# F821: undefined name
# F841: local variable assigned but never used
# E402: module level import not at top of file
# I100: your import statements are in the wrong order.
Expand All @@ -17,7 +18,7 @@
# W293: line break before binary operator
# W293: blank line contains whitespace
select = E,F,W,C
ignore = F403, F811, F841, E231, E402, I100, I101, D400, E501, E501, E503, E731, W293, W503
ignore = F403, F811, F821, F841, E231, E402, I100, I101, D400, E501, E501, E503, E731, W293, W503
extend-ignore = E203
max-complexity = 15
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dist: bionic
language: python
python:
- 3.7
- 3.8
sudo: required
services:
- docker
Expand All @@ -15,7 +15,8 @@ jobs:
- pip install -r dev-requirements.txt
script:
- set -e
- make build-all
- travis_wait 60 make build/base-notebook
- travis_wait 60 make build/illumidesk-notebook
- pytest -vv

stages:
Expand Down
16 changes: 3 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@ PYTHON=${VENV_BIN}/python3

# Need to list the images in build dependency order
ALL_STACKS:=base-notebook \
learner-notebook \
instructor-notebook \
grader-notebook \
rstudio \
theia \
vscode
illumidesk-notebook

ALL_IMAGES:=$(ALL_STACKS)

ALL_TEST_IMAGES:=base-notebook \
rstudio \
theia \
vscode

# Linter
HADOLINT="${HOME}/hadolint"

Expand All @@ -42,9 +32,9 @@ help:
build/%: DARGS?=
build/%: TAG?=
build/%: ## build the latest image for a stack
docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):$(TAG) ./$(notdir $@)
jupyter-repo2docker --no-run --user-id 1000 --user-name jovyan --image-name $(OWNER)/$(notdir $@):$(TAG) ./$(notdir $@) .
@echo -n "Built image size: "
@docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}"
@docker images $(OWNER)/$(notdir $@):$(TAG) --format "{{.Size}}"

build-all: $(foreach I,$(ALL_IMAGES), build/$(I)) ## build all stacks

Expand Down
53 changes: 16 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ make build-all
Running the image standalone is helpful for testing:

```bash
docker run -p 8888:8888 illumidesk/base-notebook:latest
docker run -p 8888:8888 illumidesk/illumidesk-notebook:latest
```

> Refer to [docker's documentation](https://docs.docker.com/engine/reference/run/) for additional `docker run ...` options.
Expand All @@ -34,11 +34,7 @@ docker run -p 8888:8888 illumidesk/base-notebook:latest
| --- | --- |
| illumidesk/base-notebook | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/base-notebook)](https://img.shields.io/docker/automated/illumidesk/base-notebook?label=base-notebook) |
| illumidesk/grader-notebook | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/grader-notebook)](https://hub.docker.com/repository/docker/illumidesk/base-notebook?label=grader-notebook) |
| illumidesk/instructor-notebook | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/instructor-notebook)](https://hub.docker.com/repository/docker/illumidesk/instructor-notebook?label=instructor-notebook) |
| illumidesk/learner-notebook | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/learner-notebook)](https://hub.docker.com/repository/docker/illumidesk/learner-notebook?label=learner-notebook) |
| illumidesk/rstudio | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/rstudio)](https://hub.docker.com/repository/docker/illumidesk/rstudio?label=rstudio) |
| illumidesk/theia | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/theia)](https://hub.docker.com/repository/docker/illumidesk/theia?label=theia) |
| illumidesk/vscode | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/vscode)](https://hub.docker.com/repository/docker/illumidesk/vscode?label=vscode) |
| illumidesk/illumidesk-notebook | [![Docker Image](https://img.shields.io/docker/automated/illumidesk/instructor-notebook)](https://hub.docker.com/repository/docker/illumidesk/illumidesk-notebook?label=illumidesk-notebook) |

### Images prepared for Learning Tools Interoperability (LTI) Roles

Expand All @@ -54,7 +50,7 @@ docker run -p 8888:8888 illumidesk/base-notebook:latest

The IllumiDesk docker layers for grader images are illustrated below:

![Jupyter notebook grader images](/img/grader_images.png)
![Jupyter notebook grader images](/img/docker_stacks_v2.png)

### Additional Workspace Types

Expand All @@ -64,41 +60,30 @@ The IllumiDesk docker layers for grader images are illustrated below:

The IllumiDesk docker layers for workspace types are illustrated below:

![Jupyter notebook workspace images](/img/workspace_images.png)
![Jupyter notebook workspace images](/img/docker_stacks_v2.png)

## Build Mechanism

1. Build and tag the base image or all images at once:
1. Build and tag the base image or all images at once. Use the `TAG` argument to add your custom tag. The `TAG` argument defaults to `latest` if not specified:

```bash
make build/base-image TAG=mytag
make build/base-notebook TAG=mytag
```

or
The base image uses the standard `repo2docker` convention to set dependencies. [Refer to this project's documentaiton](https://repo2docker.readthedocs.io/en/latest/) for additional configuration options.

```bash
make build-all TAG=mytag
```


2. Use the base image from step 1 above as:

a) A base image and add additional layers to said image to create your own custom image
2. (Optional) Use the base image from step 1 above as a base image for an image compatible with the illumidesk stack.

```
FROM illumidesk/base-notebook:latest
RUN ...
```
FROM jupyter/minimal-notebook:latest AS base
or

b) A source image for files necessary to use image with the [IllumiDesk](https://github.com/IllumiDesk/illumidesk) stack.

```
FROM illumidesk/base-notebook:latest AS base
FROM illumidesk/base-notebook:latest
FROM acme/image:tag
ENV NB_USER=jovyan
ENV NB_UID=1000
ENV NB_GID="${NB_GID}"
ENV HOME="/home/${NB_USER}"
COPY --from=base /usr/local/bin/start* /usr/local/bin/
COPY --from=base /usr/local/bin/fix-permissions /usr/local/bin/
Expand All @@ -107,7 +92,7 @@ COPY --from=base /etc/jupyter/jupyter_notebook_config.py /etc/jupyter/
RUN ...
```

3. Push images to DockerHub
2. Push images to DockerHub

```bash
docker push organization/custom-image
Expand All @@ -118,13 +103,7 @@ docker push organization/custom-image
Tests start the docker container(s), runs commands by emulating the `docker exec ...` command, and asserts the outputs. You can run tests on one image or all images. Use the `TAG` key to specify a docker image tag to test (TAG defaults to `latest`):

```bash
make test/base-notebook TAG=mytag
```

or (using default `latest` tag):

```bash
make test-all
pytest -v
```

## References
Expand Down
123 changes: 0 additions & 123 deletions base-notebook/Dockerfile

This file was deleted.

Loading

0 comments on commit 552ec6a

Please sign in to comment.