Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Nov 25, 2024
1 parent 86c0fb9 commit 28119a0
Showing 1 changed file with 128 additions and 0 deletions.
128 changes: 128 additions & 0 deletions docker/oracle/Dockerfile.23
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#
# Since: September, 2023
# Author: gvenzl
# Name: Dockerfile.23
# Description: Dockerfile to build Oracle Database 23 Free
#
# Copyright 2023 Gerald Venzl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM oraclelinux:8-slim as builder

ARG BUILD_MODE BUILD_VERSION DB_FLAVOR ARCH RPM_ARCH

ENV OCI_IMAGE_VERSION=${BUILD_VERSION} \
OCI_IMAGE_FLAVOR=${BUILD_MODE} \
ORACLE_BASE=/opt/oracle \
ORACLE_BASE_CONFIG=/opt/oracle/product/23${DB_FLAVOR}/dbhomeFree \
ORACLE_BASE_HOME=/opt/oracle/product/23${DB_FLAVOR}/dbhomeFree \
ORACLE_HOME=/opt/oracle/product/23${DB_FLAVOR}/dbhomeFree \
ORACLE_SID=FREE \
PATH=${PATH}:/opt/oracle/product/23${DB_FLAVOR}/dbhomeFree/bin:/opt/oracle \
NLS_LANG=.AL32UTF8

COPY oracle-database-free-23${DB_FLAVOR}-${BUILD_VERSION}-1.0-1.el8.${RPM_ARCH}.rpm install.23.sh container-entrypoint.sh resetPassword createAppUser createDatabase healthcheck.sh /install/

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

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

FROM scratch as os_layer

ARG DB_FLAVOR

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

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

##########################################################################################
### Layer 2 --> Oracle Home without bin/oracle, lib, rdbms, and FREE.7z
##########################################################################################

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}"/"${ORACLE_SID}".7z


##########################################################################################
### 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}"/"${ORACLE_SID}".7z "${ORACLE_BASE}"/

##########################################################################################
### Finalize (reset permissions for root owned files, set label, user, etc.)
##########################################################################################

RUN chown root "${ORACLE_HOME}"/bin/extjob; \
chmod 4750 "${ORACLE_HOME}"/bin/extjob; \
chown root "${ORACLE_HOME}"/rdbms/admin/externaljob.ora; \
chmod 640 "${ORACLE_HOME}"/rdbms/admin/externaljob.ora; \
chown root "${ORACLE_HOME}"/bin/jssu; \
chmod 4750 "${ORACLE_HOME}"/bin/jssu

LABEL org.opencontainers.image.title="Oracle Database Free Container images"
LABEL org.opencontainers.image.description="Oracle Database Free for everyone!"
LABEL org.opencontainers.image.authors="Gerald Venzl"
LABEL org.opencontainers.image.source=https://github.com/gvenzl/oci-oracle-free
LABEL org.opencontainers.image.licenses=Apache-2.0
LABEL org.opencontainers.image.documentation=https://github.com/gvenzl/oci-oracle-free/blob/main/README.md

USER oracle
WORKDIR ${ORACLE_BASE}

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

ENTRYPOINT ["container-entrypoint.sh"]

0 comments on commit 28119a0

Please sign in to comment.