码迷,mamicode.com
首页 > Web开发 > 详细

WebLogic 1036的镜像构建

时间:2017-11-20 16:11:26      阅读:600      评论:0      收藏:0      [点我收藏+]

标签:pen   pie   tps   read   value   hat   running   filesyste   org   

WebLogic1035版本构建出来的镜像有问题,部署应用激活后返回的是后面pod的ip和端口号,在1036版本和12.1.3版本都无此问题。

weblogic 1036的Dockerfile

[root@k8s-node-1 weblogic1036jdk1.6]# cat Dockerfile
#CENSE MIT License 2015
#
# GIBAHOLMS DOCKERFILES PROJECT
# -----------------------------------------
# This is the Dockerfile for a default installation for Oracle WebLogic Server 11g (10.3.6) Generic Distribution
# 
# IMPORTANT
# -----------------------------------------
# The resulting image of this Dockerfile DOES NOT contain a WLS Domain.
# For that, you must to create a domain on a new inherited image.
#
# REQUIRED FILES TO BUILD THIS IMAGE
# -----------------------------------------
# (1) wls1036_generic.jar (Oracle WebLogic Server 10.3.6 Generic Installer)
#
# (2) jdk-7u79-linux-x64.rpm (Oracle Java SE Development Kit 7 for Linux x64 RPM)
#
# HOW TO BUILD THIS IMAGE
# -----------------------------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run: 
#      $ sudo docker build -t gibaholms/weblogic:10.3.6 . 
#
# AUTHOR
# -----------------------------------------
# Gilberto Holms <gibaholms85@gmail.com>
# https://gibaholms.wordpress.com/
# -----------------------------------------

# Pull base image
# ---------------
FROM oraclelinux:7

# Maintainer
# ----------
MAINTAINER ericnie <niejian437>

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV JAVA_RPM jdk-6u45-linux-x64.bin
ENV WLS_PKG wls1036_generic.jar
ENV JAVA_HOME /u01/jdk1.6.0_45

# Setup required packages (unzip), filesystem, and oracle user
# ------------------------------------------------------------
RUN mkdir -p /u01/oracle  &&     chmod a+xr /u01 

COPY $JAVA_RPM wls-silent.xml /u01/

# Install and configure Oracle JDK
# -------------------------------------
WORKDIR /u01

RUN /u01/$JAVA_RPM &&     rm /u01/$JAVA_RPM 

WORKDIR /u01

ENV PATH $PATH:/u01/jdk1.6.0_45/bin

# Installation of WebLogic
COPY $WLS_PKG /u01/ 
RUN /u01/jdk1.6.0_45/bin/java -jar $WLS_PKG -mode=silent -silent_xml=/u01/wls-silent.xml && \ 
    rm -rf /u01/$WLS_PKG &&         rm -rf /u01/wls-silent.xml &&     rm -rf /tmp/* 

WORKDIR /u01/oracle/

#ENV PATH $PATH:/u01/oracle/wlserver_10.3/common/bin

# Define default command to start bash. 

 

涉及到的wls-silent.xml文件.

[root@k8s-node-1 weblogic1036jdk1.6]# cat wls-silent.xml
<?xml version="1.0" encoding="UTF-8"?>
<bea-installer> 
    <input-fields>
        <data-value name="BEAHOME" value="/u01/oracle" />
        <data-value name="USER_INSTALL_DIR" value="/u01/oracle" />
        <data-value name="COMPONENT_PATHS" value="WebLogic Server/Core Application Server|WebLogic Server/Administration Console|WebLogic Server/Configuration Wizard and Upgrade Framework|WebLogic Server/Web 2.0 HTTP Pub-Sub Server|WebLogic Server/WebLogic JDBC Drivers|WebLogic Server/Third Party JDBC Drivers|WebLogic Server/WebLogic Server Clients|WebLogic Server/WebLogic Web Server Plugins|WebLogic Server/UDDI and Xquery Support" />
        <data-value name="INSTALL_NODE_MANAGER_SERVICE" value="no" />
        <data-value name="INSTALL_SHORTCUT_IN_ALL_USERS_FOLDER" value="no"/>
        <data-value name="LOCAL_JVMS" value="/u01/jdk1.6.0_45"/>
    </input-fields>
</bea-installer>

 

构建域

[root@k8s-node-1 1036domainjdk6]# cat Dockerfile 
# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by creating a sample domain.
#
# The base-domain created here has Java EE 7 APIs enabled by default:
#  - JAX-RS 2.0 shared lib deployed
#  - JPA 2.1, 
#  - WebSockets and JSON-P
#
# Util scripts are copied into the image enabling users to plug NodeManager 
# magically into the AdminServer running on another container as a Machine.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run: 
#      $ sudo docker build -t 1213-domain --build-arg ADMIN_PASSWORD=welcome1 .
#

# Pull base image
# ---------------
FROM ericnie/weblogic:10.3.6-jdk6u45v2

# Maintainer
# ----------
MAINTAINER Bruno Borges <bruno.borges@oracle.com>

# WLS Configuration
# -------------------------------
ARG ADMIN_PASSWORD
ARG PRODUCTION_MODE

ENV DOMAIN_NAME="base_domain"     DOMAIN_HOME="/u01/oracle/user_projects/domains/base_domain"     ADMIN_PORT="7001"     ADMIN_HOST="wlsadmin"     NM_PORT="5556"     MS_PORT="7002"     PRODUCTION_MODE="${PRODUCTION_MODE:-prod}"     JAVA_OPTIONS="-Dweblogic.security.SSL.ignoreHostnameVerification=true -Djava.security.egd=file:///dev/urandom"     CLASSPATH=""     PATH=$PATH:/u01/oracle/wlserver_10.3/common/bin:/u01/oracle/user_projects/domains/base_domain/bin:/u01/oracle/

# Add files required to build this image
COPY container-scripts/* /u01/oracle/

RUN mkdir /u01/oracle/application

# Configuration of WLS Domain
WORKDIR /u01/oracle
RUN /u01/oracle/wlst /u01/oracle/create-wls-domain.py &&     mkdir -p /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security &&     echo "username=weblogic" > /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security/boot.properties && \ 
    echo "password=$ADMIN_PASSWORD" >> /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security/boot.properties &&     cp /u01/oracle/setDomainEnv.sh /u01/oracle/user_projects/domains/base_domain/bin/setDomainEnv.sh &&     echo ". /u01/oracle/user_projects/domains/base_domain/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && \ 
    echo "export PATH=$PATH:/u01/oracle/wlserver_10.3/common/bin:/u01/oracle/user_projects/domains/base_domain/bin" >> /u01/oracle/.bashrc &&     rm /u01/oracle/create-wls-domain.py /u01/oracle/jaxrs2-template.jar 

#    cp /u01/oracle/commEnv.sh /u01/oracle/wlserver_10.3/common/bin/commEnv.sh && # Expose Node Manager default port, and also default http/https ports for admin console
EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT

WORKDIR $DOMAIN_HOME 

# Define default command to start bash. 
CMD ["startWebLogic.sh"]

中间的create-wls-domain.py

[root@k8s-node-1 container-scripts]# cat create-wls-domain.py 
# Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
#
# WebLogic on Docker Default Domain
#
# Domain, as defined in DOMAIN_NAME, will be created in this script. Name defaults to base_domain.
#
# Since : October, 2014
# Author: bruno.borges@oracle.com
# ==============================================
domain_name  = os.environ.get("DOMAIN_NAME", "base_domain")
admin_port   = int(os.environ.get("ADMIN_PORT", "7001"))
admin_pass   = os.environ.get("ADMIN_PASSWORD")
cluster_name = os.environ.get("CLUSTER_NAME", "DockerCluster")
domain_path  = /u01/oracle/user_projects/domains/%s % domain_name
production_mode         = os.environ.get("PRODUCTION_MODE", "prod")

print(domain_name : [%s] % domain_name);
print(admin_port  : [%s] % admin_port);
print(cluster_name: [%s] % cluster_name);
print(domain_path : [%s] % domain_path);
print(production_mode : [%s] % production_mode);

# Open default domain template
# ======================
readTemplate("/u01/oracle/wlserver_10.3/common/templates/domains/wls.jar")

set(Name, domain_name)
setOption(DomainName, domain_name)

# Disable Admin Console
# --------------------
# cmo.setConsoleEnabled(false)

# Configure the Administration Server and SSL port.
# =========================================================
cd(/Servers/AdminServer)
set(ListenAddress, ‘‘)
set(ListenPort, admin_port)

# Define the user password for weblogic
# =====================================
cd(/Security/%s/User/weblogic % domain_name)
cmo.setPassword(admin_pass)

# Write the domain and close the domain template
# ==============================================
setOption(OverwriteDomain, true)
setOption(ServerStartMode, prod)



# Write Domain
# ============
writeDomain(domain_path)
closeTemplate()
# Exit WLST
# =========
exit()

 

WebLogic 1036的镜像构建

标签:pen   pie   tps   read   value   hat   running   filesyste   org   

原文地址:http://www.cnblogs.com/ericnie/p/7866686.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!