首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Gitlab部署Vue.js构建

使用Gitlab部署Vue.js构建
EN

Stack Overflow用户
提问于 2020-05-13 07:29:30
回答 1查看 1.3K关注 0票数 3

这是我的gitlab管道。Vue.js工件是在运行程序上构建的。如何将测试服务器部署到我的测试服务器?FYI:Fab pull在回购上做git pull

代码语言:javascript
复制
deploy_staging:
  image: python:3.6
  stage: deploy
  only:
    - master
  before_script:
    - curl -sL https://deb.nodesource.com/setup_13.x | bash -
    - apt-get update -y
    - apt-get install -y curl git gnupg nodejs
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - |
      cat >~/.ssh/config <<EOF
      Host testserver
          ForwardAgent yes
          HostName dev.testserver.ts
          User testuser
      EOF
    - cat ~/.ssh/config
  script:
    - pip install -r requirements.txt
    - npm install
    - npm run production
    - fab pull
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-13 11:29:07

由于您希望将文件从GitLab运行程序复制到您的服务器,因此可以使用scp命令进行复制。例如:

代码语言:javascript
复制
⋮
 script:
    - pip install -r requirements.txt
    - npm install
    - npm run production
    - scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /PATH/TO/BUILD_ARTIFACTS testserver:~/PATH/TO/DESTINATION
    - fab pull

UserKnownHostsFileStrictHostKeyChecking是防止错误Host key verification failed的SSH选项。因此,在您的情况下,它们应该与scp命令一起使用。

此外,工件文件的目标路径必须从testuser的主目录(Tilde字符~)启动,否则可能会遇到Permission denied错误。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61768739

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档