Skip to content

Commit

Permalink
Merge pull request oracle#952 from ericsmalling/shrinkFMWImage
Browse files Browse the repository at this point in the history
Implemented multistage Dockerfile to shrink FMW image size
  • Loading branch information
mriccell authored Sep 14, 2018
2 parents 792c357 + 5424698 commit 167394a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
27 changes: 18 additions & 9 deletions OracleFMWInfrastructure/dockerfiles/12.2.1.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# From
# -------------------------
FROM oracle/serverjre:8
FROM oracle/serverjre:8 as builder

# Maintainer
# ----------
Expand All @@ -32,7 +32,6 @@ ENV ORACLE_HOME=/u01/oracle \
USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" \
DOMAIN_NAME="${DOMAIN_NAME:-InfraDomain}" \
DOMAIN_HOME=/u01/oracle/user_projects/domains/${DOMAIN_NAME:-InfraDomain} \
VOLUME_DIR=/u01/oracle/user_projects \
PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts


Expand Down Expand Up @@ -60,11 +59,7 @@ COPY $FMW_PKG install.file oraInst.loc /u01/
RUN chown oracle:oracle -R /u01 && \
chmod +xr $SCRIPT_FILE && \
yum install -y libaio && \
rm -rf /var/cache/yum && \
mkdir -p $VOLUME_DIR && \
chown -R oracle:oracle $VOLUME_DIR

VOLUME $VOLUME_DIR
rm -rf /var/cache/yum


# Install
Expand All @@ -74,7 +69,21 @@ RUN cd /u01 && $JAVA_HOME/bin/jar xf /u01/$FMW_PKG && cd - && \
$JAVA_HOME/bin/java -jar /u01/$FMW_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebLogic Server" && \
rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/oraInst.loc /u01/install.file

WORKDIR ${ORACLE_HOME}
# Final image stage
FROM store/oracle/serverjre:8
ENV ORACLE_HOME=/u01/oracle \
VOLUME_DIR=/u01/oracle/user_projects \
PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts

RUN mkdir -p /u01 && \
chmod a+xr /u01 && \
useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle && \
mkdir -p $VOLUME_DIR

COPY --from=builder --chown=oracle:oracle /u01 /u01

# Define default command to start script.
VOLUME $VOLUME_DIR

USER oracle
WORKDIR ${ORACLE_HOME}
CMD ["/u01/oracle/container-scripts/createOrStartInfraDomain.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CONNECTION_STRING=InfraDB:1521/InfraPDB1.us.oracle.com
RCUPREFIX=INFRA6
DB_PASSWORD=MyDBPassword
DB_USERNAME=sys
ADMIN_PASSWORD=MyWLSAdminPassword
DB_SCHEMA_PASSWORD=MyDBPassword
ADMIN_PASSWORD=MyWLSAdminPassword123
DB_SCHEMA_PASSWORD=MyDBPasswd
DOMAIN_NAME=InfraDomain

0 comments on commit 167394a

Please sign in to comment.