使用阿里CICD流水线打包Vue项目到阿里的docker镜像私仓,并自动部署到服务器启动服务

文章目录

使用阿里CICD流水线打包Vue项目到阿里的docker镜像私仓,并自动部署到服务器启动服务

1、功能实现原理大家可以看我之前的两篇文章

SpringBoot+Vue前后端分离项目在Linux系统中基于Docker打包发布,并上传镜像到阿里镜像私仓
使用阿里CICD流水线打包Java项目到阿里的docker镜像私仓,并自动部署到服务器启动服务

2、打包vue项目和打包咱们的Java项目过程差不多相同,大家可以看着上面的Java打包过程进行实验,下面是vue打包过程中几个特别的地方

2.1、流水线模板使用Node.js

2.2、编辑Node.js构建

2.3、在添加的镜像构建并推送至阿里云镜像仓库个人版中进行编辑


2.4、在vue项目下和src同级创建Dockerfile文件和default.conf文件

Dockerfile

java 复制代码
FROM nginx
COPY dist /usr/share/nginx/html
RUN rm -f /etc/nginx/conf.d/default.conf
#ADD default.conf /etc/nginx/conf.d/default.conf
COPY  default.conf /etc/nginx/conf.d/default.conf

default.conf

java 复制代码
upstream wms-app {
    server 192.168.11.87:3999 ;
}
server {
    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;
        try_files $uri $uri/ /index.html; #解决单页面找不到路径问题 404
    }

    location /api {
            proxy_pass http://wms-app;  #可以配置多个下游服务,具有负载功能
    }

    #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;
    }

    # 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;
    #}
}

3、然后就保存运行即可

4、部署过程可以看下面这篇文章

阿里CICD流水线Docker部署,将阿里镜像私仓中的镜像部署到服务器中

相关推荐
Hello--_--World20 分钟前
Vue指令:v-if vs v-show、v-if 与 v-for 的优先级冲突、自定义指令
前端·javascript·vue.js
DigitalOcean33 分钟前
DigitalOcean VPC 网络故障排查 Runbook 实战指南
运维·服务器
Damon小智42 分钟前
腾讯云轻量服务器部署 OpenClaw + QClaw 全流程实践:打造随时在线的个人 AI 助手
服务器·云计算·腾讯云
嵌入式×边缘AI:打怪升级日志1 小时前
Tina SDK Linux Kernel 基本使用(实战篇:为开发板添加用户按键驱动支持)
linux·运维·服务器
日取其半万世不竭1 小时前
Excalidraw 自建部署指南:白板协作工具完全私有化
服务器·网络·数据库
瞎折腾啥啊1 小时前
VCPKG详细使用教程
linux·c++·cmake·cmakelists
我是Superman丶1 小时前
Docker 命令自用
运维·docker·容器
不懒不懒1 小时前
【保姆级教程:阿里云百炼 API Key 获取与 OpenAI 兼容调用指南】
阿里云·云计算
爱莉希雅&&&1 小时前
MySQL MGR + MySQL Router 高可用集群完整笔记(含手动配置 + Shell 接管双路线)
linux·数据库·笔记·mysql·mysqlrouter·mysqlshell
牛奶2 小时前
1秒下单10万次,服务器是怎么扛住的?
大数据·服务器·后端