Skip to content

Commit

Permalink
Added data science notebook image (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
atheo89 authored Oct 20, 2022
1 parent 04a9179 commit 903f181
Show file tree
Hide file tree
Showing 10 changed files with 2,045 additions and 27 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ jupyter-minimal-ubi8-python-3.8: base-ubi8-python-3.8
jupyter/minimal/ubi8-python-3.8/requirements.txt)
$(call image,jupyter/minimal/ubi8-python-3.8,base/ubi8-python-3.8)

# Build and push jupyter-datascience-ubi8-python-3.8 image to the registry
.PHONY: jupyter-datascience-ubi8-python-3.8
jupyter-datascience-ubi8-python-3.8: jupyter-minimal-ubi8-python-3.8
$(call pip_compile,bootstrap/ubi8-python-3.8,\
base/ubi8-python-3.8/requirements.in jupyter/minimal/ubi8-python-3.8/requirements.in jupyter/datascience/ubi8-python-3.8/requirements.in,\
jupyter/datascience/ubi8-python-3.8/requirements.txt)
$(call image,jupyter/datascience/ubi8-python-3.8,jupyter/minimal/ubi8-python-3.8)

# Download kubectl binary
.PHONY: bin/kubectl
bin/kubectl:
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ graph TB
%% base
ubi8py38(UBI8 Python 3.8)-->base-ubi8py38("Notebooks Base<br/>(base-ubi8-python-3.8)");
base-ubi8py38("Notebooks Base<br/>(base-ubi8-python-3.8)")--> minimal("Minimal Notebook<br/>(jupyter-minimal-ubi8-python-3.8)");
minimal("Minimal Notebook<br/>(jupyter-minimal-ubi8-python-3.8)")--> datascience("Data Science Notebook<br/>(jupyter-datascience-ubi8-python-3.8)");
end
```

Expand Down Expand Up @@ -51,6 +52,24 @@ You can use a different registry by overwriting the `IMAGE_REGISTRY` variable:
make -e IMAGE_REGISRY=quay.io/YOUR_USER/notebooks jupyter-minimal-ubi8-python-3.8
```

### Building jupyter-datascience-ubi8-python-3.8 image

The jupyter-datascience-ubi8-python-3.8 notebook image includes a list of generic datascience packages.

Build the `jupyter-datascience-ubi8-python-3.8` by running the following command:

```shell
make jupyter-datascience-ubi8-python-3.8
```

The image will be built and pushed to the [quay.io/opendatahub/notebooks](https://quay.io/opendatahub/notebooks) repository.

You can use a different registry by overwriting the `IMAGE_REGISTRY` variable:

```shell
make -e IMAGE_REGISRY=quay.io/YOUR_USER/notebooks jupyter-datascience-ubi8-python-3.8
```

## Testing

Deploy the notebook images in your Kubernetes environment (replace
Expand Down
12 changes: 6 additions & 6 deletions base/ubi8-python-3.8/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,9 @@ python-string-utils==1.0.0 \
--hash=sha256:dcf9060b03f07647c0a603408dc8b03f807f3b54a05c6e19eb14460256fac0cb \
--hash=sha256:f1a88700baf99db1a9b6953f44181ad9ca56623c81e257e6009707e2e7851fa4
# via openshift
pytz==2022.4 \
--hash=sha256:2c0784747071402c6e99f0bafdb7da0fa22645f06554c7ae06bf6358897e9c91 \
--hash=sha256:48ce799d83b6f8aab2020e369b627446696619e79645419610b9facd909b3174
pytz==2022.5 \
--hash=sha256:335ab46900b1465e714b4fda4963d87363264eb662aab5e65da039c25f1f5b22 \
--hash=sha256:c4d88f472f54d615e9cd582a5004d1e5f624854a6a27a6211591c251f22a6914
# via rfc5424-logging-handler
pytz-deprecation-shim==0.1.0.post0 \
--hash=sha256:8314c9692a636c8eb3bda879b9f119e350e93223ae83e70e80c31675a0fdc1a6 \
Expand Down Expand Up @@ -751,9 +751,9 @@ thoth-common==0.36.4 \
# thamos
# thoth-analyzer
# thoth-python
thoth-python==0.16.10 \
--hash=sha256:652eb186dcf9a3689eea2bd2169708d1b6ad21dee987eaf62183f8fd00080420 \
--hash=sha256:6be7c4723fdeea6043c372f9de4240613c3d5cf6b8aee3b41324f85dbd22a4de
thoth-python==0.16.11 \
--hash=sha256:b0659e665fd8c634b45ebd2b3317d59132ccbd7451c42ac2a0704704deef6cb8 \
--hash=sha256:e53dbb15b22bb5f4b1a80767476c96ffccddf043da2a90475bd312a64326c69e
# via thamos
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
Expand Down
21 changes: 21 additions & 0 deletions jupyter/datascience/ubi8-python-3.8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

LABEL name="odh-notebook-jupyter-datascience-ubi8-python-3.8" \
summary="Jupyter data science notebook image for ODH notebooks" \
description="Jupyter data science notebook image with base Python 3.8 builder image based on UBI8 for ODH notebooks" \
io.k8s.display-name="Jupyter data science notebook image for ODH notebooks" \
io.k8s.description="Jupyter data science notebook image with base Python 3.8 builder image based on UBI8 for ODH notebooks" \
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
io.openshift.build.commit.ref="main" \
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/datascience/ubi8-python-3.8" \
io.openshift.build.image="quay.io/opendatahub/notebooks:jupyter-datascience-ubi8-python-3.8"

COPY requirements.txt ./

RUN python -m pip install -r requirements.txt && \
rm -f requirements.txt

# Fix permissions to support pip in Openshift environments
RUN chmod -R g+w /opt/app-root/lib/python3.8/site-packages && \
fix-permissions /opt/app-root -P
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: jupyter-datascience-ubi8-python-3-8-
commonLabels:
app: jupyter-datascience-ubi8-python-3-8
resources:
- service.yaml
- statefulset.yaml
images:
- name: quay.io/opendatahub/notebooks
newName: quay.io/opendatahub/notebooks
newTag: jupyter-datascience-ubi8-python-3.8
15 changes: 15 additions & 0 deletions jupyter/datascience/ubi8-python-3.8/kustomize/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Service
metadata:
name: notebook
labels:
app: notebook
spec:
type: ClusterIP
ports:
- port: 8888
protocol: TCP
targetPort: notebook-port
selector:
app: notebook
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: notebook
annotations:
opendatahub.io/username: jovyan
labels:
opendatahub.io/user: jovyan
spec:
replicas: 1
selector: {}
serviceName: notebook
template:
metadata:
labels: {}
spec:
containers:
- name: notebook
image: quay.io/opendatahub/notebooks:jupyter-datascience-ubi8-python-3.8
imagePullPolicy: Always
workingDir: /opt/app-root/src
env:
- name: NOTEBOOK_ARGS
value: |-
--ServerApp.port=8888
--ServerApp.token=''
--ServerApp.password=''
--ServerApp.base_url=/notebook/opendatahub/jovyan
--ServerApp.quit_button=False
--ServerApp.tornado_settings={"user":"jovyan","hub_host":"https://opendatahub.io","hub_prefix":"/notebookController/jovyan"}
ports:
- name: notebook-port
protocol: TCP
containerPort: 8888
livenessProbe:
tcpSocket:
port: notebook-port
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /notebook/opendatahub/jovyan/api
port: notebook-port
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 500m
memory: 2Gi
17 changes: 17 additions & 0 deletions jupyter/datascience/ubi8-python-3.8/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# JupyterLab data science requirements
scikit-learn==0.24.1
kafka-python==2.0.2
matplotlib==3.4.1
pandas==1.2.4
numpy==1.19.2
boto3==1.17.11
scipy==1.6.2

# JupyterLab extensions
jupyterlab-requirements==0.16.2
jupyter-resource-usage==0.6.1
jupyterlab-s3-browser==0.10.1
jupyterlab-widgets==3.0.3
jupyterlab-lsp==3.10.0
jupyter-bokeh==3.0.4
plotly==5.5.0
Loading

0 comments on commit 903f181

Please sign in to comment.