diff --git a/docs/docs/user_docs/user_guide/server-docker.md b/docs/docs/user_docs/user_guide/server-docker.md new file mode 100644 index 00000000..51b45102 --- /dev/null +++ b/docs/docs/user_docs/user_guide/server-docker.md @@ -0,0 +1,36 @@ +### Hippo4J Server Docker镜像构建 +可以通过以下命令快速构建Hippo4J Server: +方式一: +``` +//进入到hippo4j-server工程路径下 +mvn clean package +//默认打包是打包的tag是latest +docker build -t hippo4j-server ../hippo4j-server +``` +方式二: +通过maven docker plugin +``` +//进入到hippo4j-server工程路径下 +mvn clean package -DskipTests docker:build +``` +#### Docker 镜像方式搭建Hippo4J Server: + +- 下载镜像 + +``` +// Docker地址:https://hub.docker.com/r/xxxx/hippo4j-server/ (建议指定版本号) +docker pull hippo4j-server +``` + +- 创建容器并运行 + +``` +docker run -p 6691:6691 --name hippo4j-server -d hippo4j-server:{指定版本} + +/** +* 如需自定义 mysql 等配置,可通过 "-e PARAMS" 指定,参数格式 PARAMS="--key=value --key2=value2" ; +* 配置项参考文件:/hippo4j-server/src/main/resources/application.properties +* 如需自定义 JVM内存参数 等配置,可通过 "-e JAVA_OPTS" 指定,参数格式 JAVA_OPTS="-Xmx512m" ; +*/ +docker run -e PARAMS="--spring.datasource.url=jdbc:mysql://localhost:3306/hippo4j_manager?characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8" -p 6691:6691 --name hippo4j-server -d hippo4j-server:{指定版本} +``` diff --git a/hippo4j-server/Dockerfile b/hippo4j-server/Dockerfile new file mode 100644 index 00000000..8c0ef870 --- /dev/null +++ b/hippo4j-server/Dockerfile @@ -0,0 +1,30 @@ +# 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. + +FROM openjdk:8-jre-slim +MAINTAINER lijianxin + +ENV PARAMS="" + +ENV TZ=PRC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ADD conf/hippo4j-logback.xml /opt/hippo4j/logback.xml +ADD target/hippo4j-server.jar /opt/hippo4j/hippo4j-server.jar + +WORKDIR /opt/hippo4j + +ENTRYPOINT ["sh","-c","java -jar -Dhippo4j.home=/opt/hippo4j $JAVA_OPTS /opt/hippo4j/hippo4j-server.jar --server.tomcat.basedir=/opt/tomcat --logging.config=/opt/hippo4j/logback.xml $PARAMS"] \ No newline at end of file diff --git a/hippo4j-server/pom.xml b/hippo4j-server/pom.xml index dbf7d139..35fda466 100644 --- a/hippo4j-server/pom.xml +++ b/hippo4j-server/pom.xml @@ -87,6 +87,23 @@ + + + com.spotify + docker-maven-plugin + 1.2.2 + + ${project.artifactId}:${project.version} + ${project.basedir} + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + +