支持docker

pull/3/head
tanghc 4 years ago
parent 3b2a7f92d7
commit 02d3955d00
  1. 16
      doc/docs/files/10010_快速体验.md
  2. 12
      docker-entrypoint.sh
  3. 2
      dockerfile
  4. 15
      sop-gateway/src/main/docker/dockerfile

@ -1,5 +1,7 @@
# 快速体验 # 快速体验
## 方式1
> 运行环境:JDK8,Maven3,[Nacos](https://nacos.io/zh-cn/docs/what-is-nacos.html),Mysql > 运行环境:JDK8,Maven3,[Nacos](https://nacos.io/zh-cn/docs/what-is-nacos.html),Mysql
- 安装并启动Nacos,[安装教程](https://nacos.io/zh-cn/docs/quick-start.html) - 安装并启动Nacos,[安装教程](https://nacos.io/zh-cn/docs/quick-start.html)
@ -14,6 +16,20 @@
2. 运行`SopStoryApplication.java` 2. 运行`SopStoryApplication.java`
- 找到sop-test,运行`com.gitee.sop.test.AlipayClientPostTest.testGet`进行接口调用测试 - 找到sop-test,运行`com.gitee.sop.test.AlipayClientPostTest.testGet`进行接口调用测试
## 方式2(docker)
> 前提:安装好docker
- 安装并启动Nacos,[安装教程](https://nacos.io/zh-cn/docs/quick-start.html)
- 执行Mysql脚本`sop.sql`(Mysql版本5.6+),5.6以下运行`sop-mysql5.6以下版本.sql`
- 打开`docker-entrypoint.sh`,修改mysql,nacos地址
- 执行`docker-build.sh`
- 找到sop-test,运行`com.gitee.sop.test.AlipayClientPostTest.testGet`进行接口调用测试
> admin地址:http://ip:8082/
> 文档地址:http://ip:8083/
## 使用admin ## 使用admin
- 找到`sop-admin/sop-admin-server`工程,打开sop-admin-server下的`application-dev.properties`,修改相关配置 - 找到`sop-admin/sop-admin-server`工程,打开sop-admin-server下的`application-dev.properties`,修改相关配置

@ -3,11 +3,11 @@
JAVA_OPTS="-Xms128m -Xmx128m" JAVA_OPTS="-Xms128m -Xmx128m"
# mysql, nacos配置 # mysql, nacos配置
CONF="--mysql.host=10.1.30.110:3306 --register.url=10.1.30.110:8848" args="--mysql.host=10.1.30.110:3306 --register.url=10.1.30.110:8848"
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway/sop-gateway.jar $CONF --logging.file.path=/sop/sop-gateway/log & java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-gateway/sop-gateway.jar $args --logging.file.path=/sop/sop-gateway/log &
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin/sop-admin.jar $CONF --logging.file.path=/sop/sop-admin/log & java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-admin/sop-admin.jar $args --logging.file.path=/sop/sop-admin/log &
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website/sop-website.jar $CONF --logging.file.path=/sop/sop-website/log & java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-website/sop-website.jar $args --logging.file.path=/sop/sop-website/log &
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-auth/sop-auth.jar $CONF --logging.file.path=/sop/sop-auth/log & java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-auth/sop-auth.jar $args --logging.file.path=/sop/sop-auth/log &
# 最后一条没有& # 最后一条没有&
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story/sop-story.jar $CONF --logging.file.path=/sop/sop-story/log java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /sop/sop-story/sop-story.jar $args --logging.file.path=/sop/sop-story/log

@ -2,12 +2,14 @@ FROM java:8
VOLUME /tmp VOLUME /tmp
VOLUME /sop VOLUME /sop
# 将所有应用放到一个镜像当中
ADD sop-gateway/target/*.jar sop/sop-gateway/sop-gateway.jar ADD sop-gateway/target/*.jar sop/sop-gateway/sop-gateway.jar
ADD sop-admin/sop-admin-server/target/*.jar sop/sop-admin/sop-admin.jar ADD sop-admin/sop-admin-server/target/*.jar sop/sop-admin/sop-admin.jar
ADD sop-website/target/*.jar sop/sop-website/sop-website.jar ADD sop-website/target/*.jar sop/sop-website/sop-website.jar
ADD sop-auth/target/*.jar sop/sop-auth/sop-auth.jar ADD sop-auth/target/*.jar sop/sop-auth/sop-auth.jar
ADD sop-example/sop-story/target/*.jar sop/sop-story/sop-story.jar ADD sop-example/sop-story/target/*.jar sop/sop-story/sop-story.jar
# 拷贝启动脚本
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh

@ -1,15 +0,0 @@
FROM java:8
VOLUME /tmp
VOLUME /log
ADD *.jar app.jar
# JVM设置
ENV JAVA_OPTS="-Xms128m -Xmx128m"
# springboot配置文件
# --logging.file:日志
# --mysql.host:mysql地址
# --register.url:nacos地址
ENV CONF="--logging.file=log/spring.log --mysql.host=10.1.30.120:3306 --register.url=10.1.30.110:8848"
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.jar ${CONF}
Loading…
Cancel
Save