forked from oracle/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
168 lines (160 loc) · 6.55 KB
/
Dockerfile
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# # Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
# #
# # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
# #
# # Author: Kaushik C
# #
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Access Manager 12.2.1.4.0
#
#
# Base image of this dockerfile is the FMW Infrastructure 12.2.1.4.0 docker image.
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# See oam.download file in the install directory
# fmw_12.2.1.4.0_idm_generic.jar &
#
# Pull base image
# ---------------
FROM oracle/fmw-infrastructure:12.2.1.4.0 as base
#
#
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV FMW_IDM_JAR=fmw_12.2.1.4.0_idm_generic.jar \
BASE_DIR=/u01 \
ORACLE_HOME=/u01/oracle \
PATCH_DIR=/tmp/patches \
OPATCH_PATCH_DIR=/tmp/opatch \
OPATCH_NO_FUSER=true \
SCRIPT_DIR=/u01/oracle/dockertools \
HEALTH_SCRIPT_FILE=/u01/oracle/dockertools/get_healthcheck_url.sh \
PROPS_DIR=/u01/oracle/properties \
USER_PROJECTS_DIR=/u01/oracle/user_projects \
DOMAIN_ROOT=/u01/oracle/user_projects/domains \
DOMAIN_NAME="${DOMAIN_NAME:-oam_domain}" \
DOMAIN_HOME="${DOMAIN_ROOT}"/"${DOMAIN_NAME}" \
ADMIN_USER="${ADMIN_USER:-}" \
ADMIN_PASSWORD="${ADMIN_PASSWORD:-}" \
CONNECTION_STRING="${CONNECTION_STRING:-OamDB:1521/orclpdb1.localdomain}" \
CONTAINER_DIR=/u01/oracle/user_projects/container \
ADMIN_LISTEN_HOST="${ADMIN_LISTEN_HOST:-}" \
ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \
ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}" \
DOMAIN_TYPE="${DOMAIN_TYPE:-oam}" \
RCUPREFIX=${RCUPREFIX:-OAM01} \
DB_USER=${DB_USER:-} \
DB_PASSWORD=${DB_PASSWORD:-} \
DB_SCHEMA_PASSWORD=${DB_SCHEMA_PASSWORD:-} \
USER_MEM_ARGS=${USER_MEM_ARGS:-"-Djava.security.egd=file:/dev/./urandom"} \
JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true" \
PATH=$PATH:/usr/java/default/bin:$ORACLE_HOME/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/dockertools
#
# Creation of User, Directories and Installation of OS packages
# ----------------------------------------------------------------
USER root
RUN mkdir -p ${BASE_DIR} && \
chmod a+xr ${BASE_DIR} && chown oracle:root ${BASE_DIR} && \
mkdir -p ${USER_PROJECTS_DIR} && \
chown -R oracle:root ${USER_PROJECTS_DIR} && chmod -R 775 ${USER_PROJECTS_DIR} && \
mkdir -p ${CONTAINER_DIR} && \
chown -R oracle:root ${CONTAINER_DIR} && chmod -R 775 ${CONTAINER_DIR} && \
mkdir -p ${SCRIPT_DIR} && chown oracle:root ${SCRIPT_DIR} && \
mkdir -p ${PROPS_DIR} && chown oracle:root ${PROPS_DIR} && \
mkdir ${PATCH_DIR} && \
mkdir ${OPATCH_PATCH_DIR} && \
chown -R oracle:root ${BASE_DIR} && \
chown -R oracle:root ${PATCH_DIR} && \
chown -R oracle:root ${OPATCH_PATCH_DIR}
#
FROM base as builder
# Copy packages and scripts
# -------------------------
COPY --chown=oracle:root Dockerfile patches/* ${PATCH_DIR}/
COPY --chown=oracle:root Dockerfile opatch_patch/* ${OPATCH_PATCH_DIR}/
COPY container-scripts/* ${SCRIPT_DIR}/
COPY install/* ${BASE_DIR}/
ADD $FMW_IDM_JAR ${BASE_DIR}/
#
# Update Permissions for packages and scripts
# --------------------------------------------
RUN cd ${BASE_DIR} && chmod 755 *.jar && \
chmod a+xr ${SCRIPT_DIR}/* && \
chown -R oracle:root ${CONTAINER_DIR} && chmod -R 775 ${CONTAINER_DIR} && \
chown oracle:root ${SCRIPT_DIR}/*
#
# Installation of IDM Binaries
# --------------------------------------------
USER oracle
WORKDIR ${ORACLE_HOME}
RUN cd ${BASE_DIR} && \
#install IDM in silent mode
$JAVA_HOME/bin/java -jar ${BASE_DIR}/$FMW_IDM_JAR -silent -responseFile ${BASE_DIR}/iam.response -invPtrLoc ${ORACLE_HOME}/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=${ORACLE_HOME} && \
rm -fr ${BASE_DIR}/*.jar ${BASE_DIR}/*.response && \
rm -f ${OPATCH_PATCH_DIR}/Dockerfile && \
rm -f ${PATCH_DIR}/Dockerfile
#
# Apply patch to OPatch
#
USER oracle
WORKDIR ${ORACLE_HOME}
RUN opatchzip=`ls ${OPATCH_PATCH_DIR}/p*.zip 2>/dev/null`; \
if [ ! -z "$opatchzip" ]; then \
cd ${OPATCH_PATCH_DIR}; \
echo -e "\nBelow patch present in opatch_patch directory. Applying this patch:" ; \
ls p*.zip ; \
echo -e "" ; \
opatchfile=`ls p*.zip` ; \
$JAVA_HOME/bin/jar xf $opatchfile ; \
$JAVA_HOME/bin/java -jar ${OPATCH_PATCH_DIR}/6880880/opatch_generic.jar -silent oracle_home=$ORACLE_HOME; \
if [ $? -ne 0 ]; then \
echo "Applying patch to opatch Failed" ; \
exit 1 ; \
fi; \
cd /tmp; \
rm ${OPATCH_PATCH_DIR}/*.zip; \
rm -r ${OPATCH_PATCH_DIR}/; \
fi
#
# Apply product patches
#
RUN patchzips=`ls ${PATCH_DIR}/p*.zip 2>/dev/null`; \
if [ ! -z "$patchzips" ]; then \
cd ${PATCH_DIR}; \
echo -e "\nBelow patches present in patches directory. Applying these patches:"; \
ls p*.zip; \
echo -e ""; \
$ORACLE_HOME/OPatch/opatch napply -silent -oh $ORACLE_HOME -jre $JAVA_HOME -phBaseDir ${PATCH_DIR}; \
if [ $? -ne 0 ]; then \
echo "opatch napply Failed"; \
exit 1; \
fi; \
$ORACLE_HOME/OPatch/opatch util cleanup -silent -oh ${ORACLE_HOME}; \
if [ $? -ne 0 ]; then \
echo "opatch cleanup Failed"; \
exit 1; \
fi; \
cd /tmp; \
rm ${PATCH_DIR}/*.zip; \
rm -r ${PATCH_DIR}/; \
rm -rf ${ORACLE_HOME}/cfgtoollogs/opatch/*; \
echo -e "\nPatches applied in OAM oracle home are:"; \
cd $ORACLE_HOME/OPatch; \
$ORACLE_HOME/OPatch/opatch lspatches; \
else \
echo -e "\nNo patches present in patches directory. Skipping patch application."; \
fi
FROM base as FINAL_BUILD
RUN yum install -y libaio hostname && \
rm -rf /var/cache/yum
COPY --from=builder --chown=oracle:root $BASE_DIR $BASE_DIR
RUN sed -i '/@@audit\/createCASBAudit.sql/s/@@audit\/createCASBAudit.sql/--@@audit\/createCASBAudit.sql/g' /u01/oracle/idm/common/sql/oam/sql/oam.sql && \
sed -i '/@@diagnostic\/createIdmDiagnosticLogRecord.sql/s/@@diagnostic\/createIdmDiagnosticLogRecord.sql/--@@diagnostic\/createIdmDiagnosticLogRecord.sql/g' /u01/oracle/idm/common/sql/oam/sql/oam.sql
# Define default command to start script.
USER oracle
HEALTHCHECK --start-period=5m --interval=1m CMD curl -k -s --fail `$HEALTH_SCRIPT_FILE` || exit 1
WORKDIR $ORACLE_HOME
# Define default command to start bash.
CMD ["sh", "-c", "${SCRIPT_DIR}/createDomainAndStart.sh"]