diff --git a/.dockerignore b/.dockerignore index d78ef07..3dbbcf3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -21,8 +21,5 @@ **/obj **/secrets.dev.yaml **/values.dev.yaml -**/*.jar -service/opt/ -web/html/ LICENSE README.md diff --git a/.gitignore b/.gitignore index f1c8e72..3f1dad1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -**/*.jar -service/opt/ -web/html/ \ No newline at end of file +service/*.jar +service/data/ +web/html/ +images \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 826c3d0..646a270 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,15 @@ version: '2' services: military-system: build: service + image: military_system + container_name: military_system restart: on-failure ports: - - 8080:8080 + - 8049:8049 military-web: build: web + image: military_system_web + container_name: military_system_web restart: on-failure ports: - - 8089:8089 \ No newline at end of file + - 3001:3001 \ No newline at end of file diff --git a/service/Dockerfile b/service/Dockerfile index dbae733..590c0da 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -6,6 +6,9 @@ # 基础镜像 FROM openjdk:8-jdk-alpine +LABEL Author="bb, aagmix" +LABEL VERSION="1.0" + VOLUME [ "/data" ] ARG JAVA_OPTS @@ -15,6 +18,7 @@ ENV JAVA_OPTS=$JAVA_OPTS # 从当前工作目录复制文件到镜像目录中并重新命名 COPY config /military/config +COPY data /data COPY military.jar /military/military.jar # 执行Linux命令,运行jar包 diff --git a/service/config/application-prod.yml b/service/config/application-prod.yml index 640466e..205f723 100644 --- a/service/config/application-prod.yml +++ b/service/config/application-prod.yml @@ -1,5 +1,5 @@ server: - port: 8080 + port: 8049 tomcat: max-swallow-size: -1 error: @@ -187,9 +187,9 @@ jeecg: uploadType: local path: #文件上传根目录 设置 - upload: /opt/upFiles + upload: /data/upFiles #webapp文件路径 - webapp: /opt/webapp + webapp: /data/webapp shiro: excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/** #阿里云oss存储和大鱼短信秘钥配置 diff --git a/web/Dockerfile b/web/Dockerfile index c6515ed..91d8ece 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -6,6 +6,9 @@ # 基础镜像 FROM nginx +LABEL Author="bb, aagmix" +LABEL VERSION="1.0" + # config COPY nginx.conf /etc/nginx COPY conf.d /etc/nginx/conf.d @@ -13,6 +16,6 @@ COPY conf.d /etc/nginx/conf.d COPY html /usr/share/nginx/html # 暴露端口 -EXPOSE 8089 +EXPOSE 3001 CMD "nginx" "-g" "daemon off;" \ No newline at end of file diff --git a/web/conf.d/default.conf b/web/conf.d/default.conf index 31f2cfb..5a28b02 100644 --- a/web/conf.d/default.conf +++ b/web/conf.d/default.conf @@ -1,21 +1,45 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream back_end { + server military-system:8049; # appserver_ip:ws_port +} + server { - listen 8089; - listen [::]:8089; + listen 3001; + listen [::]:3001; server_name localhost; + # 后台服务配置,配置了这个location便可以通过访问 - location ^~ /military { - proxy_pass http://military-system:8080/military/; - proxy_set_header Host $host:8089; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 - location / { - root /usr/share/nginx/html; - index index.html index.htm; - if (!-e $request_filename) { - rewrite ^(.*)$ /index.html?s=$1 last; - break; - } - } + location ^~ /military { + proxy_pass http://back_end/military/; + proxy_set_header Host $host:3001; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + location ^~ /military/websocket { + proxy_pass http://back_end/military/websocket/; + proxy_read_timeout 300s; + proxy_send_timeout 300s; + + proxy_set_header Host $host:3001; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + } + } + + #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 + location / { + root /usr/share/nginx/html; + index index.html index.htm; + if (!-e $request_filename) { + rewrite ^(.*)$ /index.html?s=$1 last; + break; + } + } } \ No newline at end of file