diff --git a/.gitignore b/.gitignore index 6c3d3ef..3a2b387 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ did.iml **/target/ **/dependency-reduced-pom.xml -did-server/docker \ No newline at end of file +did-server/_build.sh \ No newline at end of file diff --git a/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java b/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java index 1cc9b27..aa32bd3 100644 --- a/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java +++ b/did-sdk/src/test/java/cn/ceres/did/DidSdkTest.java @@ -17,7 +17,8 @@ public class DidSdkTest { @Test public void didSdkTest() throws Exception { - SdkClient client = new SdkClient("10.19.248.200", 30581); + // SdkClient client = new SdkClient("10.19.248.200", 30581); + SdkClient client = new SdkClient(); client.init(); client.start(); diff --git a/did-server/Dockerfile b/did-server/Dockerfile deleted file mode 100644 index 3288e2d..0000000 --- a/did-server/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM anapsix/alpine-java:latest -MAINTAINER ehlxr - -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"] \ No newline at end of file diff --git a/did-server/_build.sh b/did-server/_build.sh new file mode 100755 index 0000000..5606bfd --- /dev/null +++ b/did-server/_build.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +echo "############## start ##############" +BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S` + +#cd ../ +SERVER_NAME=`awk '/[^<]+<\/name>/{gsub(/|<\/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} ##############" \ No newline at end of file diff --git a/did-server/build.sh b/did-server/build.sh index ea0da23..1ac5cab 100755 --- a/did-server/build.sh +++ b/did-server/build.sh @@ -6,7 +6,8 @@ BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S` SERVER_NAME=`awk '/[^<]+<\/name>/{gsub(/|<\/name>/,"",$1);print $1;exit;}' pom.xml` #SERVER_NAME=$(basename `pwd`) mvn clean install -DskipTests -cp target/${SERVER_NAME}*.jar . +cp target/${SERVER_NAME}*.jar ./docker +cd docker err=$? echo "############## $err ##############" diff --git a/did-server/start.sh b/did-server/start.sh deleted file mode 100755 index f22c1ac..0000000 --- a/did-server/start.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 \ No newline at end of file