docker 支持

This commit is contained in:
2022-06-24 20:07:03 +08:00
parent 19013e205d
commit 5cf7371978
8 changed files with 88 additions and 21 deletions
+5
View File
@@ -0,0 +1,5 @@
FROM nginx
COPY ./dist /usr/share/nginx/html
COPY ./conf.d/default.conf /etc/nginx/conf.d/
EXPOSE 80/tcp
+56
View File
@@ -0,0 +1,56 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
gzip_static on;
try_files $uri $uri/ /index.html;
}
location ~* \.(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ {
root /usr/share/nginx/html;
gzip_static on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location /admin-api/ {
proxy_pass http://127.0.0.1:48080/;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
+16
View File
@@ -0,0 +1,16 @@
```
前置:安装docker 并运行起来,不一定要在本地运行镜像,但是要在本地打包docker, 平时如果电脑太卡了。可以检查一下是不是用docker镜像在运行把他们全部关闭掉。
docker ps ,可以查看哪些镜像在运行
docker stop ID
```
###
1. 在vue根目录运行npm run build 打包发布包,配置打包到docker/dist目录下
###
2. cd到这个目录,运行 docker build -t zyh8419792/yudao-ui-admin . 注意后面有一个. zyh8419792是我的账户名可以改成自己的,yudao-ui-admin是我定的也可以随便改。
###
3. 运行docker push zyh8419792/yudao-ui-admin,当然这一部之前是需要先登录docker账号(docker login),如果要推送到我的仓库,需要我授权。 默认就是推送latest了
###
4. 推送完成后,进入rainbond,新建组件,选镜像构建,docker.io/zyh8419792/yudao-ui-admin,由于是nginx开启的转发,记得把服务端拉进前端的依赖