diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md b/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md index aba1e37f..5589c57c 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md @@ -4,7 +4,7 @@ ```shell # 在Yi.Abp.Net8 目录下执行 -docker build -t xxx-xxx:${BUILD_NUMBER} -f ./src/Yi.Abp.Web/Dockerfile . +docker build -t admin-server:${BUILD_NUMBER} -f ./src/Yi.Abp.Web/Dockerfile . ``` diff --git a/Yi.RuoYi.Vue3/Dockerfile b/Yi.RuoYi.Vue3/Dockerfile new file mode 100644 index 00000000..e2e186bb --- /dev/null +++ b/Yi.RuoYi.Vue3/Dockerfile @@ -0,0 +1,19 @@ +FROM node:18-alpine AS build + +WORKDIR /app + +COPY package.json yarn.lock ./ + +RUN yarn cache clean +RUN rm -rf node_modules +RUN yarn install --registry=https://registry.npmmirror.com + +COPY . . + +# RUN node --max-old-space-size=4096 +RUN yarn build:prod + +FROM nginx:alpine +COPY nginx.conf /etc/nginx/nginx.conf +COPY --from=build /app/dist /usr/share/nginx/html +CMD ["nginx", "-g", "daemon off;"] diff --git a/Yi.RuoYi.Vue3/README-DOCKER-BUILD.md b/Yi.RuoYi.Vue3/README-DOCKER-BUILD.md new file mode 100644 index 00000000..63246145 --- /dev/null +++ b/Yi.RuoYi.Vue3/README-DOCKER-BUILD.md @@ -0,0 +1,13 @@ +# Docker 构建说明 + +## 执行命令 + +```shell +# 在Yi.RuoYi.Vue3 目录下执行 +docker build -t rouoyi-web:${BUILD_NUMBER} . + +``` + +## 注意 + +nginx.conf 中替换为自己服务器后端地址 \ No newline at end of file diff --git a/Yi.RuoYi.Vue3/nginx.conf b/Yi.RuoYi.Vue3/nginx.conf new file mode 100644 index 00000000..8ddec0d3 --- /dev/null +++ b/Yi.RuoYi.Vue3/nginx.conf @@ -0,0 +1,58 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + server { + listen 80; + + server_name _; + + root /usr/share/nginx/html; + index index.html index.htm; + + location /prod-api/ { + # 替换成自己的后端服务地址 + proxy_pass http://localhost:19001/api/app/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Authorization $http_authorization; + proxy_set_header Cookie $http_cookie; + } + + location /prod-ws/ { + # 替换成自己的后端服务地址 + proxy_pass http://localhost:19001/hub/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + # rewrite ^/prod-ws(/.*)$ $1 break; + } + + location / { + try_files $uri $uri/ /index.html; + } + + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + } + + location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { + expires 1y; + add_header Cache-Control "public, no-transform"; + } + } +}