1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

#170 使用tomcat slim image

This commit is contained in:
Hai Liang Wang 2018-12-09 14:52:20 +08:00
parent 797689eee8
commit 99e9272f17
5 changed files with 62 additions and 24 deletions

View File

@ -1,4 +1,5 @@
./app/target/
./logs/
./tmp/
./data/
app/target
!app/target/contact-center-*.war.original
logs/
tmp/
data/

View File

@ -1,4 +1,4 @@
FROM chatopera/java:1.0.0
FROM tomcat:8.5.35-slim
MAINTAINER Hai Liang Wang <hain@chatopera.com>
ARG VCS_REF
@ -20,25 +20,12 @@ ENV LANG C.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL C.UTF-8
# set ENVs
ENV JAVA_HOME=/opt/java-8-oracle
ENV MAVEN_HOME=/opt/apache-maven
ENV TOMCAT_HOME=/opt/apache-tomcat
ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
# create dirs
RUN /bin/bash -c "mkdir -p /{data,logs}"
# build WAR
COPY app /app
COPY config /config
WORKDIR /app
RUN mvn clean package && \
rm -rf /opt/apache-tomcat/webapps/ROOT && \
cp target/contact-center-*.war.original /opt/apache-tomcat/webapps/ROOT.war && \
rm -rf /app && \
rm -rf /root/.m2
# copy WAR
RUN rm -rf /usr/local/tomcat/webapps/*
COPY ./app/target/contact-center-3.9.0.war.original /usr/local/tomcat/webapps/ROOT.war
COPY ./config/tomcat.context.xml /usr/local/tomcat/conf/context.xml
EXPOSE 8030-8090 9200 9300
CMD ["/opt/apache-tomcat/bin/catalina.sh", "run"]
EXPOSE 8030-8090 9200 9300

View File

@ -6,7 +6,6 @@
# constants
baseDir=$(cd `dirname "$0"`;pwd)
appHome=$baseDir/..
registry=registry.chatopera.com
imagename=chatopera/contact-center
PACKAGE_VERSION=1.0.0
# functions
@ -14,6 +13,10 @@ PACKAGE_VERSION=1.0.0
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
set -x
# package
$baseDir/package.sh
# build
cd $appHome
docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --force-rm=true --tag $imagename:$PACKAGE_VERSION .
docker tag $imagename:$PACKAGE_VERSION $imagename:develop

16
contact-center/admin/push.sh Executable file
View File

@ -0,0 +1,16 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
imagename=chatopera/contact-center
PACKAGE_VERSION=1.0.0
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
docker push $imagename:$PACKAGE_VERSION
docker push $imagename:develop

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resources cachingAllowed="true" cacheMaxSize="100000" />
</Context>