|
| 1 | +###################################################### |
| 2 | +# mongocli-builder (build stage only, not published) # |
| 3 | +###################################################### |
| 4 | +FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder |
| 5 | + |
| 6 | +ARG MONGOCLI_VERSION=2.0.3 |
| 7 | + |
| 8 | +WORKDIR /tmp/ |
| 9 | +RUN curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip |
| 10 | +RUN unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip |
| 11 | +RUN cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ && \ |
| 12 | + CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ |
| 13 | + |
| 14 | +######################## |
| 15 | +# base # |
| 16 | +######################## |
| 17 | +FROM registry.access.redhat.com/ubi9/python-312:latest AS base |
| 18 | + |
| 19 | +WORKDIR /opt/app-root/bin |
| 20 | + |
| 21 | +# OS Packages needs to be installed as root |
| 22 | +USER root |
| 23 | + |
| 24 | +# Install useful OS packages |
| 25 | +RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum |
| 26 | + |
| 27 | +# Other apps and tools installed as default user |
| 28 | +USER 1001 |
| 29 | + |
| 30 | +# Install micropipenv to deploy packages from Pipfile.lock |
| 31 | +RUN pip install --no-cache-dir -U "micropipenv[toml]" |
| 32 | + |
| 33 | +# Install the oc client |
| 34 | +RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \ |
| 35 | + -o /tmp/openshift-client-linux.tar.gz && \ |
| 36 | + tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \ |
| 37 | + rm -f /tmp/openshift-client-linux.tar.gz |
| 38 | + |
| 39 | +#################### |
| 40 | +# jupyter-minimal # |
| 41 | +#################### |
| 42 | +FROM base AS jupyter-minimal |
| 43 | + |
| 44 | +ARG JUPYTER_REUSABLE_UTILS=jupyter/utils |
| 45 | +ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12 |
| 46 | + |
| 47 | +WORKDIR /opt/app-root/bin |
| 48 | + |
| 49 | +COPY ${JUPYTER_REUSABLE_UTILS} utils/ |
| 50 | +COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./ |
| 51 | + |
| 52 | +WORKDIR /opt/app-root/src |
| 53 | + |
| 54 | +ENTRYPOINT ["start-notebook.sh"] |
| 55 | + |
| 56 | + |
| 57 | +######################## |
| 58 | +# jupytyer-datascience # |
| 59 | +######################## |
| 60 | +FROM jupyter-minimal AS jupyter-datascience |
| 61 | + |
| 62 | +ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12 |
| 63 | + |
| 64 | +LABEL name="odh-notebook-jupyter-datascience-ubi9-python-3.12" \ |
| 65 | + summary="Jupyter data science notebook image for ODH notebooks" \ |
| 66 | + description="Jupyter data science notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \ |
| 67 | + io.k8s.display-name="Jupyter data science notebook image for ODH notebooks" \ |
| 68 | + io.k8s.description="Jupyter data science notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \ |
| 69 | + authoritative-source-url="https://github.com/opendatahub-io/notebooks" \ |
| 70 | + io.openshift.build.commit.ref="main" \ |
| 71 | + io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/datascience/ubi9-python-3.12" \ |
| 72 | + io.openshift.build.image="quay.io/opendatahub/workbench-images:jupyter-datascience-ubi9-python-3.12" |
| 73 | + |
| 74 | +WORKDIR /opt/app-root/bin |
| 75 | + |
| 76 | +# OS Packages needs to be installed as root |
| 77 | +USER root |
| 78 | + |
| 79 | +# Install useful OS packages |
| 80 | +RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum |
| 81 | + |
| 82 | +# Copy dynamically-linked mongocli built in earlier build stage |
| 83 | +COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ |
| 84 | + |
| 85 | +# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution |
| 86 | +COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo |
| 87 | + |
| 88 | +RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum |
| 89 | + |
| 90 | +ENV PATH="$PATH:/opt/mssql-tools18/bin" |
| 91 | + |
| 92 | +# Other apps and tools installed as default user |
| 93 | +USER 1001 |
| 94 | + |
| 95 | +# Install Python packages and Jupyterlab extensions from Pipfile.lock |
| 96 | +COPY ${DATASCIENCE_SOURCE_CODE}/Pipfile.lock ./ |
| 97 | +# Copy Elyra setup to utils so that it's sourced at startup |
| 98 | +COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/ |
| 99 | + |
| 100 | +RUN echo "Installing softwares and packages" && \ |
| 101 | + micropipenv install && \ |
| 102 | + rm -f ./Pipfile.lock && \ |
| 103 | + # setup path for runtime configuration |
| 104 | + mkdir /opt/app-root/runtimes && \ |
| 105 | + mkdir /opt/app-root/pipeline-runtimes && \ |
| 106 | + # Remove default Elyra runtime-images \ |
| 107 | + rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \ |
| 108 | + # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \ |
| 109 | + sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ |
| 110 | + # Disable announcement plugin of jupyterlab \ |
| 111 | + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \ |
| 112 | + # Apply JupyterLab addons \ |
| 113 | + /opt/app-root/bin/utils/addons/apply.sh && \ |
| 114 | + # Fix permissions to support pip in Openshift environments \ |
| 115 | + chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \ |
| 116 | + fix-permissions /opt/app-root -P |
| 117 | + |
| 118 | +WORKDIR /opt/app-root/src |
0 commit comments