forked from nagypeter/angular-java-creditscore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.weblogic
152 lines (137 loc) · 6.18 KB
/
Dockerfile.weblogic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by creating a sample domain.
#
# Util scripts are copied into the image enabling users to plug NodeManager
# automatically into the AdminServer running on another container.
#
# PREREQUISITES:
# --------------
# This sample requires that a Java JDK 1.8 or greater version must be installed on the machine
# running the docker build command, and that the JAVA_HOME environment variable is set to the java home
# location. The sample unzips the weblogic-deploy.zip into the image using the java jar command.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Build the deployment archive file using the build-archive.sh script.
# $ ./build-archive.sh
#
# Run:
# $ sudo docker build \
# --build-arg CUSTOM_ADMIN_HOST=wlsadmin \
# --build-arg CUSTOM_ADMIN_PORT=7001 \
# --build-arg CUSTOM_ADMIN_NAME=7001 \
# --build-arg CUSTOM_MANAGED_SERVER_PORT=8001 \
# --build-arg CUSTOM_DOMAIN_NAME=base_domain \
# --build-arg CUSTOM_DEBUG_PORT=8453 \
# --build-arg WDT_MODEL=simple-topology.yaml \
# --build-arg WDT_ARCHIVE=archive.zip \
# --build-arg WDT_VARIABLE=properties/docker-build/domain.properties \
# --force-rm=true \
# -t 12213-domain-home-in-image-wdt .
#
# If the ADMIN_HOST, ADMIN_PORT, MS_PORT, DOMAIN_NAME are not provided, the variables
# are set to default values. (The values shown in the build statement).
#
# You must insure that the build arguments align with the values in the model.
# The sample model replaces the attributes with tokens that are resolved from values in the
# corresponding property file domain.properties. The container-scripts/setEnv.sh script
# demonstrates parsing the variable file to build a string of --build-args that can
# be passed on the docker build command.
#
# Pull base image
# ---------------
# FROM store/oracle/weblogic:12.2.1.3
FROM phx.ocir.io/weblogick8s/pnagy:wls.12.2.1.3.0.op.rc2
# Maintainer
# ----------
MAINTAINER Richard Killen <[email protected]>
ARG WDT_ARCHIVE
ARG WDT_VARIABLE
ARG WDT_MODEL
ARG CUSTOM_ADMIN_NAME=admin-server
ARG CUSTOM_ADMIN_HOST=wlsadmin
ARG CUSTOM_ADMIN_PORT=7001
ARG CUSTOM_MANAGED_SERVER_PORT=8001
ARG CUSTOM_DOMAIN_NAME=base_domain
ARG CUSTOM_DEBUG_PORT=8453
# Persist arguments - for ports to expose and container to use
# Create a placeholder for the manager server name. This will be provided when run the container
# Weblogic and Domain locations
# The boot.properties will be created under the DOMAIN_HOME when the admin server container is run
# WDT installation
# ---------------------------
ENV ADMIN_NAME=${CUSTOM_ADMIN_NAME} \
ADMIN_HOST=${CUSTOM_ADMIN_HOST} \
ADMIN_PORT=${CUSTOM_ADMIN_PORT} \
MANAGED_SERVER_NAME=${MANAGED_SERVER_NAME} \
MANAGED_SERVER_PORT=${CUSTOM_MANAGED_SERVER_PORT} \
DEBUG_PORT=${CUSTOM_DEBUG_PORT} \
ORACLE_HOME=/u01/oracle \
DOMAIN_NAME=${CUSTOM_DOMAIN_NAME} \
DOMAIN_PARENT=${ORACLE_HOME}/user_projects/domains
ENV DOMAIN_HOME=${DOMAIN_PARENT}/${DOMAIN_NAME} \
PROPERTIES_FILE_DIR=$ORACLE_HOME/properties \
WDT_HOME="/u01" \
SCRIPT_HOME="${ORACLE_HOME}" \
PATH=$PATH:${ORACLE_HOME}/oracle_common/common/bin:${ORACLE_HOME}/wlserver/common/bin:${DOMAIN_HOME}:${DOMAIN_HOME}/bin:${ORACLE_HOME}
COPY weblogic-deploy.zip ${WDT_HOME}
COPY container-scripts/* ${SCRIPT_HOME}/
# Create the properties file directory and the domain home parent with the correct permissions / owner.
# Unzip and install the WDT image and change the permissions / owner.
USER root
RUN chmod +xw ${SCRIPT_HOME}/*.sh && \
chown -R oracle:oracle ${SCRIPT_HOME} && \
mkdir -p +xwr $PROPERTIES_FILE_DIR && \
chown -R oracle:oracle $PROPERTIES_FILE_DIR && \
mkdir -p $DOMAIN_PARENT && \
chown -R oracle:oracle $DOMAIN_PARENT && \
chmod -R a+xwr $DOMAIN_PARENT && \
cd ${WDT_HOME} && \
$JAVA_HOME/bin/jar xf weblogic-deploy.zip && \
rm weblogic-deploy.zip && \
chmod +xw weblogic-deploy/bin/*.sh && \
chmod -R +xw weblogic-deploy/lib/python && \
chown -R oracle:oracle weblogic-deploy
# Persist the WDT tool home location
ENV WDT_HOME=$WDT_HOME/weblogic-deploy
# Copy the WDT model, archive file, variable file and credential secrets to the property file directory.
# These files will be removed after the image is built.
# Be sure to build with --force-rm to eliminate this container layer
COPY ${WDT_MODEL} ${WDT_ARCHIVE} ${WDT_VARIABLE} docker/*.properties ${PROPERTIES_FILE_DIR}/
# --chown for COPY is available in docker version 18 'COPY --chown oracle:oracle'
RUN chown -R oracle:oracle ${PROPERTIES_FILE_DIR}
# Create the domain home in the docker image.
#
# The create domain tool creates a domain at the DOMAIN_HOME location
# The domain name is set using the value in the model / variable files
# The domain name can be different from the DOMAIN_HOME domain folder name.
#
# Set WORKDIR for @@PWD@@ global token in model file
WORKDIR $ORACLE_HOME
USER oracle
RUN if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file $PROPERTIES_FILE_DIR/${WDT_MODEL##*/}"; fi && \
if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file $PROPERTIES_FILE_DIR/${WDT_ARCHIVE##*/}"; fi && \
if [ -n "$WDT_VARIABLE" ]; then VARIABLE_OPT="-variable_file $PROPERTIES_FILE_DIR/${WDT_VARIABLE##*/}"; fi && \
${WDT_HOME}/bin/createDomain.sh \
-oracle_home $ORACLE_HOME \
-java_home $JAVA_HOME \
-domain_home $DOMAIN_HOME \
-domain_type WLS \
$VARIABLE_OPT \
$MODEL_OPT \
$ARCHIVE_OPT && \
echo ". $DOMAIN_HOME/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && \
rm -rf $PROPERTIES_FILE_DIR
# Mount the domain home and the WDT home for easy access.
VOLUME $DOMAIN_HOME
VOLUME $WDT_HOME
# Expose admin server, managed server port and domain debug port
EXPOSE $ADMIN_PORT $MANAGED_SERVER_PORT $DEBUG_PORT
WORKDIR $DOMAIN_HOME
# Define default command to start Admin Server in a container.
CMD ["/u01/oracle/startAdminServer.sh"]