From 3cf4bc8c38a4778d2233ea88c776f688c8831fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Tue, 13 Jan 2026 09:25:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0hyf=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 16 +++++++++++++++ docker/hyf/conf/nginx.conf | 41 ++++++++++++++++++++++++++++++++++++++ docker/hyf/dockerfile | 15 ++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 docker/hyf/conf/nginx.conf create mode 100644 docker/hyf/dockerfile diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3b7095d..fca5d60 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -65,6 +65,22 @@ services: - ruoyi-gateway links: - ruoyi-gateway + ruoyi-hyf: + container_name: ruoyi-hyf + image: hyf-runtime + build: + context: ./nginx + ports: + - "9988:80" + volumes: + - ./nginx/html/dist:/home/ruoyi/projects/ruoyi-ui + - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf + - ./nginx/logs:/var/log/nginx + - ./nginx/conf.d:/etc/nginx/conf.d + depends_on: + - ruoyi-gateway + links: + - ruoyi-gateway ruoyi-gateway: container_name: ruoyi-gateway image: gateway-runtime diff --git a/docker/hyf/conf/nginx.conf b/docker/hyf/conf/nginx.conf new file mode 100644 index 0000000..8102642 --- /dev/null +++ b/docker/hyf/conf/nginx.conf @@ -0,0 +1,41 @@ +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/ruoyi-ui; + try_files $uri $uri/ /index.html; + index index.html index.htm; + } + + location /prod-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://ruoyi-gateway:8080/; + } + + # 避免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/hyf/dockerfile b/docker/hyf/dockerfile new file mode 100644 index 0000000..df3f9c9 --- /dev/null +++ b/docker/hyf/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM registry.t-aaron.com/nginx:latest +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi/projects/ruoyi-ui +# 创建目录 +RUN mkdir -p /home/ruoyi/projects/ruoyi-ui +# 指定路径 +WORKDIR /home/ruoyi/projects/ruoyi-ui +# 复制conf文件到路径 +COPY ./conf/nginx.conf /etc/nginx/nginx.conf +# 复制html文件到路径 +COPY ./html/dist /home/ruoyi/projects/ruoyi-ui