|  | 
| 1 |  | -#Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. | 
|  | 1 | +#Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. | 
| 2 | 2 | # | 
| 3 | 3 | #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | 
| 4 | 4 | # | 
|  | 
| 11 | 11 | # | 
| 12 | 12 | # HOW TO BUILD THIS IMAGE | 
| 13 | 13 | # ----------------------- | 
| 14 |  | -# Put all downloaded files in the same directory as this Dockerfile | 
|  | 14 | + | 
| 15 | 15 | # Build the deployment archive file using the build-archive.sh script. | 
| 16 | 16 | #      $ ./build-archive.sh | 
| 17 | 17 | # | 
| 18 | 18 | # Run: | 
| 19 | 19 | #      $ sudo docker build \ | 
|  | 20 | +#            --build-arg CUSTOM_ADMIN_HOST=wlsadmin \ | 
|  | 21 | +#            --build-arg CUSTOM_ADMIN_PORT=7001 \ | 
|  | 22 | +#            --build-arg CUSTOM_ADMIN_NAME=7001 \ | 
|  | 23 | +#            --build-arg CUSTOM_MANAGED_SERVER_PORT=8001 \ | 
|  | 24 | +#            --build-arg CUSTOM_DOMAIN_NAME=base_domain \ | 
|  | 25 | +#            --build-arg CUSTOM_DEBUG_PORT=8453 \ | 
| 20 | 26 | #            --build-arg WDT_MODEL=simple-topology.yaml \ | 
| 21 | 27 | #            --build-arg WDT_ARCHIVE=archive.zip \ | 
|  | 28 | +#            --build-arg WDT_VARIABLE=properties/docker-build/domain.properties \ | 
| 22 | 29 | #            --force-rm=true \ | 
| 23 | 30 | #            -t 12213-domain-wdt . | 
| 24 | 31 | # | 
|  | 32 | +# If the ADMIN_HOST, ADMIN_PORT, MS_PORT, DOMAIN_NAME are not provided, the variables  | 
|  | 33 | +# are set to default values. (The values shown in the build statement).  | 
|  | 34 | +# | 
|  | 35 | +# You must insure that the build arguments align with the values in the model.  | 
|  | 36 | +# The sample model replaces the attributes with tokens that are resolved from values in the | 
|  | 37 | +# corresponding property file domain.properties. The container-scripts/setEnv.sh script | 
|  | 38 | +# demonstrates parsing the variable file to build a string of --build-args that can | 
|  | 39 | +# be passed on the docker build command. | 
|  | 40 | +# | 
| 25 | 41 | # Pull base image | 
| 26 | 42 | # --------------- | 
| 27 | 43 | # FROM store/oracle/weblogic:12.2.1.3 | 
| 28 |  | -FROM oracle/weblogic:12.2.1.3-developer | 
|  | 44 | +FROM store/oracle/weblogic:12.2.1.3-dev | 
| 29 | 45 | 
 | 
| 30 | 46 | # Maintainer | 
| 31 | 47 | # ---------- | 
| 32 |  | -MAINTAINER Monica Riccelli <monica.riccelli@oracle.com> | 
|  | 48 | +MAINTAINER Richard Killen <richard.killen@oracle.com> | 
| 33 | 49 | 
 | 
| 34 |  | -ARG WDT_MODEL | 
| 35 | 50 | ARG WDT_ARCHIVE | 
|  | 51 | +ARG WDT_VARIABLE | 
|  | 52 | +ARG WDT_MODEL | 
|  | 53 | +ARG CUSTOM_ADMIN_NAME=admin-server | 
|  | 54 | +ARG CUSTOM_ADMIN_HOST=wlsadmin | 
|  | 55 | +ARG CUSTOM_ADMIN_PORT=7001 | 
|  | 56 | +ARG CUSTOM_MANAGED_SERVER_PORT=8001 | 
|  | 57 | +ARG CUSTOM_DOMAIN_NAME=base_domain | 
|  | 58 | +ARG CUSTOM_DEBUG_PORT=8453 | 
| 36 | 59 | 
 | 
| 37 |  | -# WLS Configuration | 
|  | 60 | +# Persist arguments - for ports to expose and container to use | 
|  | 61 | +# Create a placeholder for the manager server name. This will be provided when run the container | 
|  | 62 | +# Weblogic and Domain locations | 
|  | 63 | +# Set the start derby in admin server flag to true. Override this in the runtime properties | 
|  | 64 | +# The boot.properties will be created under the DOMAIN_HOME when the admin server container is run  | 
|  | 65 | +# WDT installation | 
| 38 | 66 | # --------------------------- | 
| 39 |  | -ENV ADMIN_HOST="wlsadmin" \ | 
| 40 |  | -    NM_PORT="5556" \ | 
| 41 |  | -    MS_PORT="8001" \ | 
| 42 |  | -    DEBUG_PORT="8453" \ | 
|  | 67 | +ENV ADMIN_NAME=${CUSTOM_ADMIN_NAME} \ | 
|  | 68 | +    ADMIN_HOST=${CUSTOM_ADMIN_HOST} \ | 
|  | 69 | +    ADMIN_PORT=${CUSTOM_ADMIN_PORT} \ | 
|  | 70 | +    MANAGED_SERVER_NAME=${MANAGED_SERVER_NAME} \ | 
|  | 71 | +    MANAGED_SERVER_PORT=${CUSTOM_MANAGED_SERVER_PORT} \ | 
|  | 72 | +    DEBUG_PORT=${CUSTOM_DEBUG_PORT} \ | 
|  | 73 | +    DERBY_FLAG="true" \ | 
| 43 | 74 |     ORACLE_HOME=/u01/oracle \ | 
| 44 |  | -    SCRIPT_FILE=/u01/oracle/createAndStartWLSDomain.sh \ | 
| 45 |  | -    CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true"  \ | 
| 46 |  | -    PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain}/bin:/u01/oracle | 
| 47 |  | - | 
| 48 |  | -# Domain and Server environment variables | 
| 49 |  | -# ------------------------------------------------------------ | 
| 50 |  | -ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" \ | 
| 51 |  | -    PRE_DOMAIN_HOME=/u01/oracle/user_projects \ | 
| 52 |  | -    ADMIN_PORT="${ADMIN_PORT:-7001}" \ | 
| 53 |  | -    WDT_MODEL="$WDT_MODEL" \ | 
| 54 |  | -    WDT_ARCHIVE="$WDT_ARCHIVE" | 
|  | 75 | +    DOMAIN_NAME=${CUSTOM_DOMAIN_NAME} \ | 
|  | 76 | +    DOMAIN_PARENT=${ORACLE_HOME}/user_projects/domains  | 
| 55 | 77 | 
 | 
| 56 |  | -# Add files required to build this image | 
| 57 |  | -COPY container-scripts/* /u01/oracle/ | 
| 58 |  | -COPY weblogic-deploy.zip /u01 | 
| 59 |  | -COPY ${WDT_MODEL} ${ARCHIVE_FILE} /u01/ | 
|  | 78 | +ENV DOMAIN_HOME=${DOMAIN_PARENT}/${DOMAIN_NAME} \ | 
|  | 79 | +    PROPERTIES_FILE_DIR=$ORACLE_HOME/properties \ | 
|  | 80 | +    WDT_HOME="/u01" \ | 
|  | 81 | +    SCRIPT_HOME="${ORACLE_HOME}" \ | 
|  | 82 | +    PATH=$PATH:${ORACLE_HOME}/oracle_common/common/bin:${ORACLE_HOME}/wlserver/common/bin:${DOMAIN_HOME}:${DOMAIN_HOME}/bin:${ORACLE_HOME} | 
| 60 | 83 | 
 | 
| 61 |  | -# this file contains credentials. | 
| 62 |  | -# be sure to build with --force-rm to eliminate this container layer | 
| 63 |  | -COPY properties /u01/oracle | 
|  | 84 | +COPY weblogic-deploy.zip ${WDT_HOME} | 
|  | 85 | +COPY container-scripts/* ${SCRIPT_HOME}/ | 
| 64 | 86 | 
 | 
| 65 |  | -# Create directory where domain will be written to | 
|  | 87 | +# Create the properties file directory and the domain home parent with the correct permissions / owner.  | 
|  | 88 | +# Unzip and install the WDT image and change the permissions / owner. | 
| 66 | 89 | USER root | 
| 67 |  | -RUN chmod +xw /u01/oracle/*.sh && \ | 
| 68 |  | -    chmod +xw /u01/oracle/*.py && \ | 
| 69 |  | -    mkdir -p $PRE_DOMAIN_HOME && \ | 
| 70 |  | -    mkdir -p $PRE_DOMAIN_HOME/domains && \ | 
| 71 |  | -    chmod a+xr $PRE_DOMAIN_HOME && \ | 
| 72 |  | -    chown -R oracle:oracle $PRE_DOMAIN_HOME && \ | 
| 73 |  | -    cd /u01 && \ | 
| 74 |  | -    $JAVA_HOME/bin/jar xf /u01/weblogic-deploy.zip && \ | 
| 75 |  | -    chmod +xw /u01/weblogic-deploy/bin/*.sh && \ | 
| 76 |  | -    chmod -R +xw /u01/weblogic-deploy/lib/python && \ | 
| 77 |  | -    if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file /u01/$WDT_MODEL"; fi && \ | 
| 78 |  | -    if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file /u01/$WDT_ARCHIVE"; fi && \ | 
| 79 |  | -    /u01/weblogic-deploy/bin/createDomain.sh \ | 
|  | 90 | +RUN chmod +xw $SCRIPT_HOME/*.sh && \  | 
|  | 91 | +    chown -R oracle:oracle ${SCRIPT_HOME} && \ | 
|  | 92 | +    mkdir -p +xwr $PROPERTIES_FILE_DIR && \ | 
|  | 93 | +    chown -R oracle:oracle $PROPERTIES_FILE_DIR && \ | 
|  | 94 | +    mkdir -p $DOMAIN_PARENT && \ | 
|  | 95 | +    chown -R oracle:oracle $DOMAIN_PARENT && \ | 
|  | 96 | +    chmod -R a+xwr $DOMAIN_PARENT && \ | 
|  | 97 | +    cd ${WDT_HOME} && \ | 
|  | 98 | +    $JAVA_HOME/bin/jar xf ./weblogic-deploy.zip && \ | 
|  | 99 | +    rm weblogic-deploy.zip && \ | 
|  | 100 | +    chmod +xw weblogic-deploy/bin/*.sh && \ | 
|  | 101 | +    chmod -R +xw weblogic-deploy/lib/python   && \ | 
|  | 102 | +    chown -R oracle:oracle weblogic-deploy  | 
|  | 103 | + | 
|  | 104 | +# Persist the WDT tool home location | 
|  | 105 | +ENV WDT_HOME=$WDT_HOME/weblogic-deploy  | 
|  | 106 | + | 
|  | 107 | +# Copy the WDT model, archive file, variable file and credential secrets to the property file directory. | 
|  | 108 | +# These files will be removed after the image is built. | 
|  | 109 | +# Be sure to build with --force-rm to eliminate this container layer | 
|  | 110 | + | 
|  | 111 | +COPY ${WDT_MODEL} ${WDT_ARCHIVE} ${WDT_VARIABLE} properties/docker-build/*.properties ${PROPERTIES_FILE_DIR}/ | 
|  | 112 | +# --chown for COPY is available in docker version 18 'COPY --chown oracle:oracle' | 
|  | 113 | +RUN chown -R oracle:oracle ${PROPERTIES_FILE_DIR} | 
|  | 114 | +          | 
|  | 115 | +# Create the domain home in the docker image. | 
|  | 116 | +# | 
|  | 117 | +# The create domain tool creates a domain at the DOMAIN_HOME location | 
|  | 118 | +# The domain name is set using the value in the model / variable files  | 
|  | 119 | +# The domain name can be different from the DOMAIN_HOME domain folder name. | 
|  | 120 | +# | 
|  | 121 | +# Set WORKDIR for @@PWD@@ global token in model file | 
|  | 122 | +WORKDIR $ORACLE_HOME | 
|  | 123 | +USER oracle | 
|  | 124 | +RUN if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file $PROPERTIES_FILE_DIR/${WDT_MODEL##*/}"; fi && \ | 
|  | 125 | +    if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file $PROPERTIES_FILE_DIR/${WDT_ARCHIVE##*/}"; fi && \ | 
|  | 126 | +    if [ -n "$WDT_VARIABLE" ]; then VARIABLE_OPT="-variable_file $PROPERTIES_FILE_DIR/${WDT_VARIABLE##*/}"; fi && \  | 
|  | 127 | +    ${WDT_HOME}/bin/createDomain.sh \ | 
| 80 | 128 |         -oracle_home $ORACLE_HOME \ | 
| 81 |  | -        -java_home ${JAVA_HOME} \ | 
| 82 |  | -        -domain_parent $PRE_DOMAIN_HOME/domains \ | 
|  | 129 | +        -java_home $JAVA_HOME \ | 
|  | 130 | +        -domain_home $DOMAIN_HOME \ | 
| 83 | 131 |         -domain_type WLS \ | 
| 84 |  | -        -variable_file /u01/oracle/domain.properties \ | 
|  | 132 | +        $VARIABLE_OPT  \ | 
| 85 | 133 |         $MODEL_OPT \ | 
| 86 | 134 |         $ARCHIVE_OPT && \ | 
| 87 |  | -    chown -R oracle:oracle $PRE_DOMAIN_HOME && \ | 
| 88 |  | -    rm /u01/oracle/domain.properties | 
|  | 135 | +    chmod -R a+x $DOMAIN_HOME/bin/*.sh && \ | 
|  | 136 | +    rm -rf $PROPERTIES_FILE_DIR  | 
| 89 | 137 | 
 | 
| 90 |  | -VOLUME $PRE_DOMAIN_HOME | 
| 91 |  | -# Expose Node Manager default port, and also default for admin and managed server | 
| 92 |  | -EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT $DEBUG_PORT | 
|  | 138 | +# Mount the domain home and the WDT home for easy access. | 
|  | 139 | +VOLUME $DOMAIN_HOME | 
|  | 140 | +VOLUME $WDT_HOME | 
| 93 | 141 | 
 | 
| 94 |  | -USER oracle | 
| 95 |  | -WORKDIR $ORACLE_HOME | 
|  | 142 | +# Expose admin server, managed server port and domain debug port | 
|  | 143 | +EXPOSE $ADMIN_PORT $MANAGED_SERVER_PORT $DEBUG_PORT | 
|  | 144 | + | 
|  | 145 | +WORKDIR $DOMAIN_HOME | 
| 96 | 146 | 
 | 
| 97 |  | -# Define default command to start bash. | 
| 98 |  | -CMD ["/u01/oracle/startWLSDomain.sh"] | 
|  | 147 | +# Define default command to start Admin Server in a container. | 
|  | 148 | +CMD ["/u01/oracle/startAdminServer.sh"] | 
0 commit comments