$ sudo apt-get remove docker \ docker-engine \ docker.io
docker-ce
$ sudo apt-get update $ sudo apt-get update $ sudo apt-get install docker-ce
$ sudo docker pull gitlab/gitlab-runner:latest
$ sudo docker run -d --name gitlab-runner --restart always \ -v /srv/gitlab-runner/config:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ gitlab/gitlab-runner:latest
略
前端
image: node:alpine stages: - build - deploy_development - deploy_production // 境變量 // 配置在項目的 variables 中 // 在須要使用 variables 的地方經過 `process.env.***` 來獲取 // 注:需設置對應的分支爲保護分支,不然拿不到對應的值(Settings > Repository > Protected Branches) variables: AccessKey_ID: $AccessKey_ID Access_Key_Secret: $Access_Key_Secret Oss_Path: $Oss_Path // 設置緩存 cache: paths: - node_modules/ - dist/ // 這裏對應上方 stages , build: stage: build script: # script 爲要執行的命令,能夠多條按順序執行 - npm install - npm run build tags: - deploy_runner // 部署測試環境 deploy_development: stage: deploy_development only: # only 定義觸發分支,即只有在dev分支提交是 才執行如下命令 - dev script: - node upload_devlopment.js tags: - deploy_runner // 部署生產環境 deploy_production: stage: deploy_production only: - master script: - node upload_production.js tags: - deploy_runner