mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 17:40:05 +08:00
feat: Docker支持-yudao-ui-admin
This commit is contained in:
parent
91f63ff813
commit
9bdd71dbf1
3
yudao-ui-admin/.dockerignore
Normal file
3
yudao-ui-admin/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.dockerignore
|
||||||
|
dist
|
||||||
|
node_modules
|
22
yudao-ui-admin/Dockerfile
Normal file
22
yudao-ui-admin/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM node:16-alpine as DIST
|
||||||
|
|
||||||
|
WORKDIR /admim
|
||||||
|
|
||||||
|
COPY ./package.json .
|
||||||
|
COPY ./yarn.lock .
|
||||||
|
COPY ./.npmrc .
|
||||||
|
RUN yarn install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
ARG NODE_ENV=""
|
||||||
|
RUN env ${NODE_ENV} yarn build:prod
|
||||||
|
|
||||||
|
## -- stage: dist => nginx --
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=DIST /admim/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
26
yudao-ui-admin/nginx.conf
Normal file
26
yudao-ui-admin/nginx.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _; ## 重要!!!修改成你的外网 IP/域名
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 1k; # 设置允许压缩的页面最小字节数
|
||||||
|
gzip_buffers 4 16k; # 用来存储 gzip 的压缩结果
|
||||||
|
gzip_http_version 1.1; # 识别 HTTP 协议版本
|
||||||
|
gzip_comp_level 2; # 设置 gzip 的压缩比 1-9。1 压缩比最小但最快,而 9 相反
|
||||||
|
gzip_types text/plain application/x-javascript text/css application/xml application/javascript; # 指定压缩类型
|
||||||
|
gzip_proxied any; # 无论后端服务器的 headers 头返回什么信息,都无条件启用压缩
|
||||||
|
|
||||||
|
location / { ## 前端项目
|
||||||
|
root /usr/share/nginx/html/;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /prod-api/ { ## 后端项目 - 管理后台
|
||||||
|
proxy_pass http://yudao-server:48080/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user