mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-07 18:14:05 +00:00
Add a recipe to install OracleDB instant client (version 21.x) (#1970)
* Add a recipe to install OracleDB instant client * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Split java install command to avoid errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Split java install command to avoid errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: lint markdown to avoid max-lenght * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: add recipe to ci-cd and fixes from review - Use ENV docker command to upload PATH variable for Jupyter notebook. - Make installation faster by removing extra `apt-get` commands. - Optimize credential files generation for the sake of legibility - Change WORKDIR back at the end. - Use mamba instead of pip to install the oracledb library. - Keep conda instructions for the sake of consistency with the rest of the recipes in the page. Like 'Add a custom conda environment and Jupyter kernel'. * Update oracledb recipe using suggestion from PR Optimize image of the docker image by chaining commands. Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com> * Fix the chaining command to remove temp files * Set the right value for WORKDIR * chore: fix ci-cd and specify recipe scope - Specify scope of the recipe to v.21. version of the plugin. - Fix the ci-cd build. - Avoid innecessary image optimisations * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: fix ci-cd and specify recipe scope - Specify scope of the recipe to v.21. version of the plugin. - Fix the ci-cd build. - Avoid innecessary image optimisations * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: remove temporary file clean * chore: fix typo * Update oracledb.dockerfile * Update recipes.md * Use alien --install * Fix typo * Unify comments * Update oracledb.dockerfile * Update oracledb.dockerfile * Add ARG to remove copy-paste --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
1
.github/workflows/contributed-recipes.yml
vendored
1
.github/workflows/contributed-recipes.yml
vendored
@@ -47,6 +47,7 @@ jobs:
|
||||
mamba_install.dockerfile,
|
||||
manpage_install.dockerfile,
|
||||
microsoft_odbc.dockerfile,
|
||||
oracledb.dockerfile,
|
||||
pip_install.dockerfile,
|
||||
rise_jupyterlab.dockerfile,
|
||||
spellcheck_notebookv6.dockerfile,
|
||||
|
54
docs/using/recipe_code/oracledb.dockerfile
Normal file
54
docs/using/recipe_code/oracledb.dockerfile
Normal file
@@ -0,0 +1,54 @@
|
||||
FROM jupyter/base-notebook
|
||||
|
||||
USER root
|
||||
|
||||
# Install java, javac and alien
|
||||
RUN apt-get update --yes && \
|
||||
apt-get install --yes --no-install-recommends software-properties-common && \
|
||||
add-apt-repository universe && \
|
||||
apt-get update --yes && \
|
||||
apt-get install --yes --no-install-recommends alien default-jre default-jdk openjdk-11-jdk libaio1 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG instantclient_major_version=21
|
||||
ARG instantclient_version=${instantclient_major_version}.11.0.0.0-1
|
||||
ARG instantclient_url=https://download.oracle.com/otn_software/linux/instantclient/2111000
|
||||
|
||||
# Then install Oracle SQL Instant client, SQL+Plus, tools and JDBC.
|
||||
# Note: You may need to change the URL to a newer version.
|
||||
# See: https://www.oracle.com/es/database/technologies/instant-client/linux-x86-64-downloads.html
|
||||
WORKDIR "/tmp"
|
||||
RUN wget --progress=dot:giga ${instantclient_url}/oracle-instantclient-basiclite-${instantclient_version}.el8.x86_64.rpm && \
|
||||
alien --install --scripts oracle-instantclient-basiclite-${instantclient_version}.el8.x86_64.rpm && \
|
||||
wget --progress=dot:giga ${instantclient_url}/oracle-instantclient-sqlplus-${instantclient_version}.el8.x86_64.rpm && \
|
||||
alien --install --scripts oracle-instantclient-sqlplus-${instantclient_version}.el8.x86_64.rpm && \
|
||||
wget --progress=dot:giga ${instantclient_url}/oracle-instantclient-tools-${instantclient_version}.el8.x86_64.rpm && \
|
||||
alien --install --scripts oracle-instantclient-tools-${instantclient_version}.el8.x86_64.rpm && \
|
||||
wget --progress=dot:giga ${instantclient_url}/oracle-instantclient-jdbc-${instantclient_version}.el8.x86_64.rpm && \
|
||||
alien --install --scripts oracle-instantclient-jdbc-${instantclient_version}.el8.x86_64.rpm && \
|
||||
chown -R "${NB_UID}":"${NB_GID}" "${HOME}/.rpmdb" && \
|
||||
rm -f ./*.rpm
|
||||
|
||||
# Configure environment
|
||||
ENV ORACLE_HOME=/usr/lib/oracle/${instantclient_major_version}/client64
|
||||
ENV PATH="${ORACLE_HOME}/bin:${PATH}"
|
||||
ENV LD_LIBRARY_PATH="${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}"
|
||||
|
||||
# (Optional) Add credentials for the Oracle Database server; files must be present on your `docker build PATH` folder.
|
||||
WORKDIR /usr/lib/oracle/${instantclient_major_version}/client64/lib/network/admin
|
||||
# Adding a wildcard `[]` on the last letter of the filename to avoid throwing an error if the file does not exist.
|
||||
# See: https://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile
|
||||
COPY cwallet.ss[o] ./
|
||||
COPY sqlnet.or[a] ./
|
||||
COPY tnsnames.or[a] ./
|
||||
|
||||
# Switch back to jovyan to avoid accidental container runs as root
|
||||
USER "${NB_UID}"
|
||||
|
||||
WORKDIR "${HOME}"
|
||||
|
||||
# Install `oracledb` Python library to use Oracle SQL Instant Client
|
||||
RUN mamba install --yes 'oracledb' && \
|
||||
mamba clean --all -f -y && \
|
||||
fix-permissions "${CONDA_DIR}" && \
|
||||
fix-permissions "/home/${NB_USER}"
|
@@ -499,3 +499,17 @@ The following recipe demonstrates how to add functionality to read from and writ
|
||||
You can now use `pyodbc` and `sqlalchemy` to interact with the database.
|
||||
|
||||
Pre-built images are hosted in the [realiserad/jupyter-docker-mssql](https://github.com/Realiserad/jupyter-docker-mssql) repository.
|
||||
|
||||
## Add Oracle SQL Instant client, SQL\*Plus and other tools (Version 21.x)
|
||||
|
||||
The following recipe demonstrates how to add functionality to connect to a Oracle Database using [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html)
|
||||
in your notebook.
|
||||
This recipe installs version `21.11.0.0.0`.
|
||||
|
||||
Nonetheless, go to the [Oracle Instant Client Download page](https://www.oracle.com/es/database/technologies/instant-client/linux-x86-64-downloads.html) for the complete list of versions available.
|
||||
You may need to perform different steps for older versions;
|
||||
the may be explained on the "Installation instructions" section of the Downloads page.
|
||||
|
||||
```{literalinclude} recipe_code/oracledb.dockerfile
|
||||
:language: docker
|
||||
```
|
||||
|
Reference in New Issue
Block a user