一、虚拟机安装
1.vmware下载
2.镜像下载
3.Ubuntu
4.新建虚拟机
一直点下一步,直到点击完成。
5.分配镜像
二、Gitlab CI/CD 自动化部署项目
1.配置GitLab CI/CD:
A.在你的Vue.js项目中,创建一个名为`.gitlab-ci.yml`的文件,放在项目根目录下。
B.在该文件中定义CI/CD的阶段、作业和脚本。
stages:
- build
- deploy
build:
stage: build
image: node:14 # 使用Node.js 14.x版本镜像
script:
- npm install
- npm run build
artifacts:
paths:
- dist/
deploy:
stage: deploy
script:
- 'which ssh-agent || ( apk add --update openssh )' # 安装SSH代理(如果没有的话)
- eval $(ssh-agent -s) # 启动SSH代理
- echo