This commit is contained in:
ehlxr 2018-08-14 18:37:07 +08:00
parent 22789bb131
commit 97897db22c
3 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,16 @@
FROM 10.19.248.200:30100/g_laikang/jre8-alpine:latest
MAINTAINER lixiangrong <lixiangrong@ennew.cn>
WORKDIR /opt
ARG SERVER_NAME
ENV SERVER_NAME=${SERVER_NAME}
COPY start.sh /opt/start.sh
COPY ${SERVER_NAME}*.jar /opt/
RUN chmod -R 755 /opt/
EXPOSE 16830 16831
ENTRYPOINT ["/opt/start.sh"]

33
did-server/docker/build.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
echo "############## start ##############"
BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S`
cd ../
SERVER_NAME=`awk '/<name>[^<]+<\/name>/{gsub(/<name>|<\/name>/,"",$1);print $1;exit;}' pom.xml`
#SERVER_NAME=$(basename `pwd`)
mvn clean install -DskipTests
cp target/${SERVER_NAME}*.jar ./docker
cd docker
err=$?
echo "############## $err ##############"
if [ "$err" -ne "0" ]; then
echo "############## build error ! ##############"
exit 1
fi
base_url=10.19.248.200:30100
docker_url=${base_url}/ceres/${SERVER_NAME}:latest
docker build --build-arg SERVER_NAME=${SERVER_NAME} -f ./Dockerfile -t ${docker_url} .
#echo "docker login -u ggov ${base_url}"
docker login -u ggov -p !qaz2wsX ${base_url}
docker push ${docker_url}
rm ${SERVER_NAME}*.jar
echo "build & push finish ..."
echo "############## ${BUILD_DATE} ##############"

19
did-server/docker/start.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
#HOSTNAME=`hostname | cut -c1-18`
LOGS_DIR="/data/logs"
if [ ! -d ${LOGS_DIR} ]; then
mkdir -p ${LOGS_DIR}
fi
STDOUT_FILE=${LOGS_DIR}/${SERVER_NAME}.log
JAVA_OPTS=" -Duser.timezone=\"Asia/Shanghai\" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF8"
JAVA_MEM_OPTS=" -server -Xmx${XMX:-512m} -Xms${XMS:-128m} -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC \
-XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=${LargePageSize:-4m} \
-XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
echo "Starting the ${SERVER_NAME} ...\c"
#java -jar ${JAVA_OPTS} ${JAVA_MEM_OPTS} ./${SERVER_NAME}-*.jar > ${STDOUT_FILE} 2>&1
java -jar ${JAVA_OPTS} ${JAVA_MEM_OPTS} ./${SERVER_NAME}-*.jar | tee -a ${STDOUT_FILE} 2>&1