Skip to content

Commit

Permalink
Multi-layer images, remove binaries and old timezone files (#204)
Browse files Browse the repository at this point in the history
* Add details for enabling In-Memory Columnar processing on XE #188 (#189)

* 21c multiple layers

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* multiple layers faststart

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Multiple layers 18c

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Update faststart for 11g

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* harmonize Dockerfiles

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* multi-layer 11g

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Use user- / group name for chown

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Document -x buildContainerImage.sh parameter

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* use env vars instead of literal

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Remove unnecessary timezone files

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Remove unecessary binaries

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Update ImageDetails with timezone files

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Cleanup comments

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Remove old timezone info 18c

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

* Further remove binaries in 18c

Signed-off-by: gvenzl <gerald.venzl@gmail.com>

---------

Signed-off-by: gvenzl <gerald.venzl@gmail.com>
Signed-off-by: Loïc LEFEVRE <loic.lefevre@gmail.com>
Co-authored-by: Loïc LEFEVRE <loic.lefevre@gmail.com>
  • Loading branch information
gvenzl and loiclefevre authored May 1, 2023
1 parent c96c28f commit 18310cf
Show file tree
Hide file tree
Showing 11 changed files with 388 additions and 57 deletions.
76 changes: 70 additions & 6 deletions Dockerfile.11202
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,91 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM oraclelinux:8-slim
FROM oraclelinux:8-slim as builder

ARG BUILD_MODE

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

ENV ORACLE_BASE=/u01/app/oracle \
ORACLE_BASE_CONFIG=/u01/app/oracle/product/11.2.0/xe \
ORACLE_BASE_HOME=/u01/app/oracle/product/11.2.0/xe \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe \
ORACLE_SID=XE \
PATH=${PATH}:/u01/app/oracle/product/11.2.0/xe/bin:/u01/app/oracle \
NLS_LANG=.AL32UTF8

COPY oracle-xe-11.2.0-1.0.x86_64.rpm xe.11202.rsp install.11202.sh container-entrypoint.sh resetPassword createAppUser healthcheck.sh /install/

RUN /install/install.11202.sh "${BUILD_MODE}"


##########################################################################################
### Layer 1 --> Core OS
##########################################################################################

FROM scratch as os_layer

# Redefine environment variables, etc. as we copied everything from an empty image (scratch)
ENV ORACLE_BASE=/u01/app/oracle \
ORACLE_BASE_CONFIG=/u01/app/oracle/product/11.2.0/xe \
ORACLE_BASE_HOME=/u01/app/oracle/product/11.2.0/xe \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe \
ORACLE_SID=XE \
PATH=${PATH}:/u01/app/oracle/product/11.2.0/xe/bin:/u01/app/oracle \
NLS_LANG=.AL32UTF8

COPY --from=builder / /
RUN rm -rf "${ORACLE_BASE}"

##########################################################################################
### Layer 2 --> Oracle Home without bin/oracle, lib, rdbms, and XE.zip
##########################################################################################

FROM os_layer as oracle_home

COPY --from=builder --chown=oracle:dba "${ORACLE_BASE}" "${ORACLE_BASE}"

RUN rm "${ORACLE_HOME}"/bin/oracle
RUN rm -r "${ORACLE_HOME}"/lib
RUN rm -r "${ORACLE_HOME}"/rdbms
RUN rm "${ORACLE_BASE}"/XE.zip


##########################################################################################
### Layer 3 --> Oracle binary (bin/oracle)
##########################################################################################

FROM oracle_home as oracle_binary

COPY --from=builder --chown=oracle:dba "${ORACLE_HOME}"/bin/oracle "${ORACLE_HOME}"/bin/oracle

##########################################################################################
### Layer 4 --> Oracle lib
##########################################################################################

FROM oracle_binary as oracle_lib

COPY --from=builder --chown=oracle:dba "${ORACLE_HOME}"/lib "${ORACLE_HOME}"/lib

##########################################################################################
### Layer 5 --> Oracle lib
##########################################################################################

FROM oracle_lib as oracle_rdbms

COPY --from=builder --chown=oracle:dba "${ORACLE_HOME}"/rdbms "${ORACLE_HOME}"/rdbms

##########################################################################################
### Layer 6 --> Oracle (compressed) db files
##########################################################################################

FROM oracle_rdbms as db_files

COPY --from=builder --chown=oracle:dba "${ORACLE_BASE}"/XE.zip "${ORACLE_BASE}"/

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

USER oracle
WORKDIR ${ORACLE_BASE}

HEALTHCHECK CMD "${ORACLE_BASE}"/healthcheck.sh >/dev/null || exit 1

ENTRYPOINT ["container-entrypoint.sh"]
ENTRYPOINT ["container-entrypoint.sh"]
74 changes: 69 additions & 5 deletions Dockerfile.1840
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM oraclelinux:8-slim
FROM oraclelinux:8-slim as builder

ARG BUILD_MODE

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

ENV ORACLE_BASE=/opt/oracle \
ORACLE_BASE_CONFIG=/opt/oracle/product/18c/dbhomeXE \
ORACLE_BASE_HOME=/opt/oracle/product/18c/dbhomeXE \
Expand All @@ -35,10 +33,76 @@ ENV ORACLE_BASE=/opt/oracle \
COPY oracle-database-xe-18c-1.0-1.x86_64.rpm install.1840.sh container-entrypoint.sh resetPassword createAppUser healthcheck.sh /install/

RUN /install/install.1840.sh "${BUILD_MODE}"


##########################################################################################
### Layer 1 --> Core OS
##########################################################################################

FROM scratch as os_layer

# Redefine environment variables, etc. as we copied everything from an empty image (scratch)
ENV ORACLE_BASE=/opt/oracle \
ORACLE_BASE_CONFIG=/opt/oracle/product/18c/dbhomeXE \
ORACLE_BASE_HOME=/opt/oracle/product/18c/dbhomeXE \
ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE \
ORACLE_SID=XE \
PATH=${PATH}:/opt/oracle/product/18c/dbhomeXE/bin:/opt/oracle \
NLS_LANG=.AL32UTF8

COPY --from=builder / /
RUN rm -rf "${ORACLE_BASE}"

##########################################################################################
### Layer 2 --> Oracle Home without bin/oracle, lib, rdbms, and XE.zip
##########################################################################################

FROM os_layer as oracle_home

COPY --from=builder --chown=oracle:oinstall "${ORACLE_BASE}" "${ORACLE_BASE}"

RUN rm "${ORACLE_HOME}"/bin/oracle
RUN rm -r "${ORACLE_HOME}"/lib
RUN rm -r "${ORACLE_HOME}"/rdbms
RUN rm "${ORACLE_BASE}"/XE.zip


##########################################################################################
### Layer 3 --> Oracle binary (bin/oracle)
##########################################################################################

FROM oracle_home as oracle_binary

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/bin/oracle "${ORACLE_HOME}"/bin/oracle

##########################################################################################
### Layer 4 --> Oracle lib
##########################################################################################

FROM oracle_binary as oracle_lib

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/lib "${ORACLE_HOME}"/lib

##########################################################################################
### Layer 5 --> Oracle lib
##########################################################################################

FROM oracle_lib as oracle_rdbms

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/rdbms "${ORACLE_HOME}"/rdbms

##########################################################################################
### Layer 6 --> Oracle (compressed) db files
##########################################################################################

FROM oracle_rdbms as db_files

COPY --from=builder --chown=oracle:oinstall "${ORACLE_BASE}"/XE.zip "${ORACLE_BASE}"/

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

USER oracle
WORKDIR ${ORACLE_BASE}

HEALTHCHECK CMD "${ORACLE_BASE}"/healthcheck.sh >/dev/null || exit 1

ENTRYPOINT ["container-entrypoint.sh"]
ENTRYPOINT ["container-entrypoint.sh"]
74 changes: 69 additions & 5 deletions Dockerfile.2130
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM oraclelinux:8-slim
FROM oraclelinux:8-slim as builder

ARG BUILD_MODE

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

ENV ORACLE_BASE=/opt/oracle \
ORACLE_BASE_CONFIG=/opt/oracle \
ORACLE_BASE_HOME=/opt/oracle/homes/OraDBHome21cXE \
Expand All @@ -35,10 +33,76 @@ ENV ORACLE_BASE=/opt/oracle \
COPY oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm install.2130.sh container-entrypoint.sh resetPassword createAppUser healthcheck.sh /install/

RUN /install/install.2130.sh "${BUILD_MODE}"


##########################################################################################
### Layer 1 --> Core OS
##########################################################################################

FROM scratch as os_layer

# Redefine environment variables, etc. as we copied everything from an empty image (scratch)
ENV ORACLE_BASE=/opt/oracle \
ORACLE_BASE_CONFIG=/opt/oracle \
ORACLE_BASE_HOME=/opt/oracle/homes/OraDBHome21cXE \
ORACLE_HOME=/opt/oracle/product/21c/dbhomeXE \
ORACLE_SID=XE \
PATH=${PATH}:/opt/oracle/product/21c/dbhomeXE/bin:/opt/oracle \
NLS_LANG=.AL32UTF8

COPY --from=builder / /
RUN rm -rf "${ORACLE_BASE}"

##########################################################################################
### Layer 2 --> Oracle Home without bin/oracle, lib, rdbms, and XE.zip
##########################################################################################

FROM os_layer as oracle_home

COPY --from=builder --chown=oracle:oinstall "${ORACLE_BASE}" "${ORACLE_BASE}"

RUN rm "${ORACLE_HOME}"/bin/oracle
RUN rm -r "${ORACLE_HOME}"/lib
RUN rm -r "${ORACLE_HOME}"/rdbms
RUN rm "${ORACLE_BASE}"/XE.zip


##########################################################################################
### Layer 3 --> Oracle binary (bin/oracle)
##########################################################################################

FROM oracle_home as oracle_binary

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/bin/oracle "${ORACLE_HOME}"/bin/oracle

##########################################################################################
### Layer 4 --> Oracle lib
##########################################################################################

FROM oracle_binary as oracle_lib

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/lib "${ORACLE_HOME}"/lib

##########################################################################################
### Layer 5 --> Oracle lib
##########################################################################################

FROM oracle_lib as oracle_rdbms

COPY --from=builder --chown=oracle:oinstall "${ORACLE_HOME}"/rdbms "${ORACLE_HOME}"/rdbms

##########################################################################################
### Layer 6 --> Oracle (compressed) db files
##########################################################################################

FROM oracle_rdbms as db_files

COPY --from=builder --chown=oracle:oinstall "${ORACLE_BASE}"/XE.zip "${ORACLE_BASE}"/

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe

USER oracle
WORKDIR ${ORACLE_BASE}

HEALTHCHECK CMD "${ORACLE_BASE}"/healthcheck.sh >/dev/null || exit 1

ENTRYPOINT ["container-entrypoint.sh"]
ENTRYPOINT ["container-entrypoint.sh"]
28 changes: 24 additions & 4 deletions Dockerfile.faststart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,29 @@

ARG BASE_IMAGE

FROM ${BASE_IMAGE}
FROM ${BASE_IMAGE} as base

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe
FROM base as cdb_pdb_seed

# Extract all files except system*.dbf and sysaux*.dbf

RUN unzip "${ORACLE_BASE}"/"${ORACLE_SID}".zip -x XE/system*.dbf XE/sysaux*.dbf -d "${ORACLE_BASE}"/oradata/ 1> /dev/null
RUN rm XE.zip

FROM cdb_pdb_seed as cdb_sysaux

COPY --from=base "${ORACLE_BASE}"/"${ORACLE_SID}".zip "${ORACLE_BASE}"/"${ORACLE_SID}".zip

RUN unzip "${ORACLE_BASE}"/"${ORACLE_SID}".zip -d "${ORACLE_BASE}"/oradata/ 1> /dev/null && \
rm "${ORACLE_BASE}"/"${ORACLE_SID}".zip
# Extract sysaux*.dbf
RUN unzip "${ORACLE_BASE}"/"${ORACLE_SID}".zip XE/sysaux*.dbf -d "${ORACLE_BASE}"/oradata/ 1> /dev/null
RUN rm XE.zip

FROM cdb_sysaux as cdb_system

COPY --from=base "${ORACLE_BASE}"/"${ORACLE_SID}".zip "${ORACLE_BASE}"/"${ORACLE_SID}".zip

# Extract system*.dbf
RUN unzip "${ORACLE_BASE}"/"${ORACLE_SID}".zip XE/system*.dbf -d "${ORACLE_BASE}"/oradata/ 1> /dev/null
RUN rm XE.zip

LABEL org.opencontainers.image.source https://github.com/gvenzl/oci-oracle-xe
Loading

0 comments on commit 18310cf

Please sign in to comment.