diff --git a/.gitignore b/.gitignore index 5a886e4..34e6f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,8 @@ docker/minio/data/ docker/minio/config/ docker/nginx/html/dist/* !docker/nginx/html/dist/.gitkeep +docker/wvp/web/html/dist/* +!docker/wvp/web/html/dist/.gitkeep runtime/* !runtime/.gitkeep *.jar diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index fe9e8a3..2b6ebe1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -361,3 +361,21 @@ services: - "8000:8000/udp" # WebRTC UDP - "9900:9000/udp" # WebRTC UDP (注意:与 minio 9000 端口冲突,可能需要调整) restart: unless-stopped + wvp-web: + container_name: wvp-web + image: wvp-web-runtime + build: + context: ./wvp/web + environment: + - TZ=Asia/Shanghai + ports: + - "28181:80" + volumes: + - ./wvp/web/html/dist:/home/ruoyi/projects/wvp-ui + - ./wvp/web/conf/nginx.conf:/etc/nginx/nginx.conf + - ./wvp/web/logs:/var/log/nginx + - ./wvp/web/conf.d:/etc/nginx/conf.d + depends_on: + - wvp-pro + links: + - wvp-pro diff --git a/docker/wvp/web/conf/nginx.conf b/docker/wvp/web/conf/nginx.conf new file mode 100644 index 0000000..fe25844 --- /dev/null +++ b/docker/wvp/web/conf/nginx.conf @@ -0,0 +1,68 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root /home/ruoyi/projects/wvp-ui; + try_files $uri $uri/ /index.html; + index index.html index.htm; + } + + # 前端静态资源(CSS、JS、图片等) + location /static/ { + root /home/ruoyi/projects/wvp-ui; + expires 30d; + access_log off; + } + + # WVP 后端 API 代理 + location /api/ { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://wvp-pro:18978; + } + + # 后端静态资源代理(快照图片等,来自后端服务) + location /snap/ { + proxy_pass http://wvp-pro:18978; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # WebSocket 代理支持 + location /ws/ { + proxy_pass http://wvp-pro:18978; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # 避免actuator暴露 + if ($uri ~ "/actuator") { + return 403; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + } +} \ No newline at end of file diff --git a/docker/wvp/web/dockerfile b/docker/wvp/web/dockerfile new file mode 100644 index 0000000..25329d8 --- /dev/null +++ b/docker/wvp/web/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM registry.t-aaron.com/nginx:latest +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi/projects/wvp-ui +# 创建目录 +RUN mkdir -p /home/ruoyi/projects/wvp-ui +# 指定路径 +WORKDIR /home/ruoyi/projects/wvp-ui +# 复制conf文件到路径 +COPY ./conf/nginx.conf /etc/nginx/nginx.conf +# 复制html文件到路径 +COPY ./html/dist /home/ruoyi/projects/wvp-ui \ No newline at end of file