diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb82e26 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# 该镜像需要依赖的基础镜像 +FROM openjdk:8-jdk-alpine +# 指定维护者名称 +MAINTAINER Mayday 420882008@qq.com +VOLUME /tmp +ARG JAR_FILE +COPY ${JAR_FILE} app.jar +COPY config config +COPY deploy/yuqing/application.yml config/application.yml +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] \ No newline at end of file diff --git a/deploy/nginx/docker-compose.yml b/deploy/nginx/docker-compose.yml new file mode 100644 index 0000000..a5a4d9a --- /dev/null +++ b/deploy/nginx/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3.0" + +services: + ngnix: #服务名称,名称可自定义 + container_name: nginx #容器名称,可自定义 + image: nginx:latest # 镜像名称 + restart: always + ports: # 容器和服务器对应的端口映射,每次新增一个站点之后一定要在这里把对应的端口映射加上,不然肯定会404 + - "80:80" + - "443:443" + privileged: true + volumes: #指定挂载目录 + - /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf + - /data/nginx/html/:/usr/share/nginx/html/ + - /data/nginx/logs/:/var/log/nginx/ + - /data/nginx/conf.d/:/etc/nginx/conf.d + - /data/nginx/cert/:/home + networks: + - nginx +# 如果使用nginx代理需要创建一个名称为nginx的network +networks: + nginx: + external: true \ No newline at end of file diff --git a/deploy/yuqing/application.yml b/deploy/yuqing/application.yml new file mode 100644 index 0000000..ecb67ce --- /dev/null +++ b/deploy/yuqing/application.yml @@ -0,0 +1,64 @@ + +# 1.设置舆情系统web访问端口,默认端口号8084 +server: + port: 8084 + servlet: + session: + cookie: + name: local-portal + max-age: 3600 + timeout: 3600 + +spring: + thymeleaf: + prefix: classpath:/templates/ + cache: false + mode: LEGACYHTML5 # 用非严格的 HTML + encoding: UTF-8 + servlet: + content-type: text/html + http: + # 设置编码 + encoding: + force: true + charset: UTF-8 + enabled: true + devtools: + restart: + enabled: true #热部署生效 + application: + name: stonedt-portal + + # 2.修改设置MySQL服务器地址和用户名及密码 + datasource: + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://mysql:3306/stonedt_portal?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&useSSL=false + username: root + password: 123456 + + + # 3.修改设置Redis服务器地址 + redis: + database: 0 + host: redis + port: 6379 + max-active: 10000 + max-idle: 10 + max-wait: 100000 + timeout: 100000 + + # flyway 自动建库建表设置 + flyway: + enabled: true + locations: classpath:db/migration + baseline-on-migrate: true + + +mybatis: + type-aliases-package: com.stonedt.intelligence.entity + mapper-locations: classpath:mapper/*.xml + +logging: + level: + com.stonedt.intelligence.dao : debug diff --git a/deploy/yuqing/docker-compose.yml b/deploy/yuqing/docker-compose.yml new file mode 100644 index 0000000..803b3e7 --- /dev/null +++ b/deploy/yuqing/docker-compose.yml @@ -0,0 +1,36 @@ +version: "3" + +services: + redis: + image: redis:latest #镜像名称 + container_name: redis #容器名称 + restart: always #重启docker引擎后该容器也重启 + volumes: #指定挂载目录 + - /data/redis:/data + mysql: + environment: + MYSQL_ROOT_PASSWORD: 123456 #root账号的密码 + image: mysql:5.7 #镜像名称 + container_name: db + restart: always + volumes: #指定挂载目录 + - /data/mysql/data:/var/lib/mysql #数据挂载 + - /data/mysql/init/:/docker-entrypoint-initdb.d/ #初始化数据 + yuqing: + image: maydays/yuqing:latest + container_name: yuqing + ports: + - "8084:8084" + links: + - redis + - mysql + depends_on: + - redis + - mysql + networks: +# - nginx + - default +# 如果使用nginx代理需要创建一个network并执行nginx下的docker-compose +#networks: +# nginx: +# external: true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1c24d57..39ef5be 100644 --- a/pom.xml +++ b/pom.xml @@ -261,6 +261,20 @@ + + com.spotify + dockerfile-maven-plugin + 1.4.9 + + + + yuqing + latest + + target/${project.build.finalName}.jar + + +