From b13849a6b95700de7dc5d401e73a82e8d7a3d009 Mon Sep 17 00:00:00 2001 From: Aditya Jain Date: Tue, 10 Oct 2023 21:49:10 +0530 Subject: [PATCH] Releasing oracle 23.3 free dockerfiles (#2712) * updated 23.2 dockerfiles to 23.3 with multistage * Added oracle 23.3 free rpm download link * Using install instead of localinstall --- OracleDatabase/SingleInstance/README.md | 6 +- .../{23.2.0 => 23.3.0}/Containerfile.free | 63 +++++++++++++------ .../{23.2.0 => 23.3.0}/checkDBStatus.sh | 0 .../{23.2.0 => 23.3.0}/checkSpace.sh | 2 +- .../{23.2.0 => 23.3.0}/configTcps.sh | 0 .../{23.2.0 => 23.3.0}/createDB.sh | 0 .../{23.2.0 => 23.3.0}/oracle-free-23c.conf | 0 .../{23.2.0 => 23.3.0}/runOracle.sh | 0 .../{23.2.0 => 23.3.0}/runUserScripts.sh | 0 .../{23.2.0 => 23.3.0}/setPassword.sh | 0 .../{23.2.0 => 23.3.0}/setupLinuxEnv.sh | 0 .../dockerfiles/buildContainerImage.sh | 2 +- 12 files changed, 49 insertions(+), 24 deletions(-) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/Containerfile.free (57%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/checkDBStatus.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/checkSpace.sh (95%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/configTcps.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/createDB.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/oracle-free-23c.conf (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/runOracle.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/runUserScripts.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/setPassword.sh (100%) rename OracleDatabase/SingleInstance/dockerfiles/{23.2.0 => 23.3.0}/setupLinuxEnv.sh (100%) diff --git a/OracleDatabase/SingleInstance/README.md b/OracleDatabase/SingleInstance/README.md index 93aa7602b2..d9f21330bf 100644 --- a/OracleDatabase/SingleInstance/README.md +++ b/OracleDatabase/SingleInstance/README.md @@ -32,7 +32,7 @@ Sample container build files to facilitate installation, configuration, and envi This project offers sample Dockerfiles for: -* Oracle Database 23c (23.2.0) Free +* Oracle Database 23c (23.3.0) Free * Oracle Database 21c (21.3.0) Enterprise Edition, Standard Edition 2 and Express Edition (XE) * Oracle Database 19c (19.3.0) Enterprise Edition and Standard Edition 2 * Oracle Database 18c (18.4.0) Express Edition (XE) @@ -63,7 +63,7 @@ Before you build the image make sure that you have provided the installation bin Parameters: -v: version to build - Choose one of: 11.2.0.2 12.1.0.2 12.2.0.1 18.3.0 18.4.0 19.3.0 21.3.0 23.2.0 + Choose one of: 11.2.0.2 12.1.0.2 12.2.0.1 18.3.0 18.4.0 19.3.0 21.3.0 23.3.0 -t: image_name:tag for the generated docker image -e: creates image based on 'Enterprise Edition' -s: creates image based on 'Standard Edition 2' @@ -327,7 +327,7 @@ To run your Oracle Database 23c FREE container image use the `docker run` comman -e ORACLE_PWD= \ -e ORACLE_CHARACTERSET= \ -v [:]/opt/oracle/oradata \ - oracle/database:23.2.0-free + oracle/database:23.3.0-free Parameters: --name: The name of the container (default: auto generated) diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/Containerfile.free b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/Containerfile.free similarity index 57% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/Containerfile.free rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/Containerfile.free index b9fb734800..c1727c4dca 100644 --- a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/Containerfile.free +++ b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/Containerfile.free @@ -13,23 +13,23 @@ # HOW TO BUILD THIS IMAGE # ----------------------- # Run: -# $ podman build -t oracle/database:23.2.0-free -f Containerfile.free . +# $ podman build -t oracle/database:23.3.0-free -f Containerfile.free . # # # Pull base image # --------------- -FROM oraclelinux:8 +FROM oraclelinux:8 as base # Labels # ------ LABEL "provider"="Oracle" \ - "issues"="https://github.com/oracle/docker-images/issues" \ - "volume.data"="/opt/oracle/oradata" \ - "volume.setup.location1"="/opt/oracle/scripts/setup" \ - "volume.setup.location2"="/docker-entrypoint-initdb.d/setup" \ - "volume.startup.location1"="/opt/oracle/scripts/startup" \ - "volume.startup.location2"="/docker-entrypoint-initdb.d/startup" \ - "port.listener"="1521" + "issues"="https://github.com/oracle/docker-images/issues" \ + "volume.data"="/opt/oracle/oradata" \ + "volume.setup.location1"="/opt/oracle/scripts/setup" \ + "volume.setup.location2"="/docker-entrypoint-initdb.d/setup" \ + "volume.startup.location1"="/opt/oracle/scripts/startup" \ + "volume.startup.location2"="/docker-entrypoint-initdb.d/startup" \ + "port.listener"="1521" ARG INSTALL_FILE_1="https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm" @@ -67,19 +67,44 @@ RUN mkdir -p "$ORACLE_BASE" && \ chmod ug+x *.sh && \ sync && \ ./"$CHECK_SPACE_FILE" && \ - yum -y install expect && \ ./"$SETUP_LINUX_FILE" && \ chown -R oracle:oinstall "$ORACLE_BASE" /home/oracle && \ sed -i -r 's/(^session\s+include\s+system-auth)/# \1/' /etc/pam.d/su && \ - unbuffer yum -y install "$INSTALL_FILE_1" && \ - yum -y remove expect && \ - rm -rf /var/cache/yum && \ - rm -rf /var/tmp/yum-* && \ mv "$CONF_FILE" /etc/sysconfig/ && \ - cd "$HOME" && \ - rm -rf "$INSTALL_DIR" && \ - "$ORACLE_BASE"/oraInventory/orainstRoot.sh && \ - "$ORACLE_HOME"/root.sh && \ + rm -rf "$INSTALL_DIR" + + +############################################# +# ------------------------------------------- +# Start new stage for installing the database +# ------------------------------------------- +############################################# + +FROM base AS builder + +# Install DB software binaries +RUN yum -y install expect && \ + unbuffer yum -y install "$INSTALL_FILE_1" + + +############################################# +# ------------------------------------------- +# Start new layer for database runtime +# ------------------------------------------- +############################################# + +FROM base + +USER oracle +COPY --chown=oracle:oinstall --from=builder $ORACLE_BASE $ORACLE_BASE +COPY --chown=oracle:oinstall --from=builder /etc/oratab /etc/oratab +COPY --from=builder /etc/init.d/oracle-free-23c /etc/init.d/oracle-free-23c +COPY --from=builder /usr/share/doc/oracle-free-23c/LICENSE /usr/share/doc/oracle-free-23c/LICENSE + +USER root +# To enforce ORACLE_SID as FREE, adding it to .bashrc +RUN $ORACLE_BASE/oraInventory/orainstRoot.sh && \ + $ORACLE_HOME/root.sh && \ echo 'export ORACLE_SID=FREE' >> /home/oracle/.bashrc && \ chown oracle.oinstall /home/oracle/.bashrc @@ -87,7 +112,7 @@ USER oracle WORKDIR /home/oracle HEALTHCHECK --interval=1m --start-period=5m --timeout=30s \ - CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1 + CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1 EXPOSE 1521/tcp diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/checkDBStatus.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/checkDBStatus.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/checkDBStatus.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/checkDBStatus.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/checkSpace.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/checkSpace.sh similarity index 95% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/checkSpace.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/checkSpace.sh index 530f05f902..5ff5d3fe8c 100644 --- a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/checkSpace.sh +++ b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/checkSpace.sh @@ -10,7 +10,7 @@ # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# CONF_FILE env var is set only for XE Database +# CONF_FILE env var is set only for FREE Database if [ "${ORACLE_SID}" = "FREE" ]; then REQUIRED_SPACE_GB=13 else diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/configTcps.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/configTcps.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/configTcps.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/configTcps.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/createDB.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/createDB.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/createDB.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/createDB.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/oracle-free-23c.conf b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/oracle-free-23c.conf similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/oracle-free-23c.conf rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/oracle-free-23c.conf diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/runOracle.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/runOracle.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/runOracle.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/runOracle.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/runUserScripts.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/runUserScripts.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/runUserScripts.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/runUserScripts.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/setPassword.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/setPassword.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/setPassword.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/setPassword.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/23.2.0/setupLinuxEnv.sh b/OracleDatabase/SingleInstance/dockerfiles/23.3.0/setupLinuxEnv.sh similarity index 100% rename from OracleDatabase/SingleInstance/dockerfiles/23.2.0/setupLinuxEnv.sh rename to OracleDatabase/SingleInstance/dockerfiles/23.3.0/setupLinuxEnv.sh diff --git a/OracleDatabase/SingleInstance/dockerfiles/buildContainerImage.sh b/OracleDatabase/SingleInstance/dockerfiles/buildContainerImage.sh index f399498f24..0239f69860 100755 --- a/OracleDatabase/SingleInstance/dockerfiles/buildContainerImage.sh +++ b/OracleDatabase/SingleInstance/dockerfiles/buildContainerImage.sh @@ -229,7 +229,7 @@ cd "${VERSION}" || { } # Which Dockerfile should be used? -if [ "${VERSION}" == "12.1.0.2" ] || [ "${VERSION}" == "11.2.0.2" ] || [ "${VERSION}" == "18.4.0" ] || [ "${VERSION}" == "23.2.0" ] || { [ "${VERSION}" == "21.3.0" ] && [ "${EDITION}" == "xe" ]; }; then +if [ "${VERSION}" == "12.1.0.2" ] || [ "${VERSION}" == "11.2.0.2" ] || [ "${VERSION}" == "18.4.0" ] || [ "${VERSION}" == "23.3.0" ] || { [ "${VERSION}" == "21.3.0" ] && [ "${EDITION}" == "xe" ]; }; then DOCKERFILE=$( if [[ -f "Containerfile.${EDITION}" ]]; then echo "Containerfile.${EDITION}"; else echo "${DOCKERFILE}.${EDITION}";fi ) fi;