Skip to content

Instantly share code, notes, and snippets.

@int2001
Last active April 23, 2025 09:59
Show Gist options
  • Select an option

  • Save int2001/e8a57e19e745fa43b29a1822035370c2 to your computer and use it in GitHub Desktop.

Select an option

Save int2001/e8a57e19e745fa43b29a1822035370c2 to your computer and use it in GitHub Desktop.
Dockerfile
FROM debian:bookworm-slim
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
# Install system dependencies and Oracle client prerequisites
RUN apt-get update && \
apt-get install -y \
build-essential \
libaio1 \
libnsl2 \
wget \
bash \
unzip \
libssl-dev \
locales \
libmagic-dev \
file \
perl \
cpanminus \
&& rm -rf /var/lib/apt/lists/*
ARG ORACLE_VERSION=19.26.0.0.0
WORKDIR /tmp
# Download Oracle Instant Client for the correct architecture
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
wget --no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
https://download.oracle.com/otn_software/linux/instantclient/1926000/instantclient-basic-linux.arm64-${ORACLE_VERSION}dbru.zip && \
wget --no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
https://download.oracle.com/otn_software/linux/instantclient/1926000/instantclient-sdk-linux.arm64-${ORACLE_VERSION}dbru.zip; \
elif [ "${TARGETARCH}" = "amd64" ]; then \
wget --no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
https://download.oracle.com/otn_software/linux/instantclient/1926000/instantclient-basic-linux.x64-${ORACLE_VERSION}dbru.zip && \
wget --no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
https://download.oracle.com/otn_software/linux/instantclient/1926000/instantclient-sdk-linux.x64-${ORACLE_VERSION}dbru.zip; \
else \
echo "Unsupported architecture"; exit 1; \
fi
# Unzip and set up Oracle Instant Client
RUN unzip instantclient-basic-linux.*-${ORACLE_VERSION}dbru.zip -d /opt/oracle && \
unzip -n instantclient-sdk-linux.*-${ORACLE_VERSION}dbru.zip -d /opt/oracle && \
mv /opt/oracle/instantclient_19_26 /opt/oracle/instantclient
# Create necessary symlinks for Oracle libraries
RUN cd /opt/oracle/instantclient && \
ln -sf libclntsh.so.19.1 libclntsh.so && \
ln -sf libclntshcore.so.19.1 libclntshcore.so && \
ln -sf libocci.so.19.1 libocci.so
# Configure environment
ENV ORACLE_HOME=/opt/oracle/instantclient
ENV LD_LIBRARY_PATH=${ORACLE_HOME}:${LD_LIBRARY_PATH}
ENV PATH="${PATH}:${ORACLE_HOME}"
# Update linker cache to include Oracle libraries
RUN echo "${ORACLE_HOME}" > /etc/ld.so.conf.d/oracle.conf && ldconfig
# Install DBD::Oracle Perl module
RUN cpanm --notest DBI && \
cpanm --notest DBD::Oracle
# Verify installation
RUN perl -MDBD::Oracle -e 'print "DBD::Oracle installed successfully\n"'
ENTRYPOINT ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment