Continuous integration GitLab CI/CD:构建后不要销毁docker容器

Continuous integration GitLab CI/CD:构建后不要销毁docker容器,continuous-integration,gitlab,Continuous Integration,Gitlab,我的用例如下:我想在更新分支后将PHP应用程序部署到docker,然后让它运行以进行手动测试 所以我想在某个URL下访问它 到目前为止,我所做的是创建一个gitlab docker runner gitlab-ci-multi-runner register --url "https://git.example.com/ci" --registration-token xxxx \ --description "dockertest" \ --executor docker

我的用例如下:我想在更新分支后将PHP应用程序部署到docker,然后让它运行以进行手动测试

所以我想在某个URL下访问它

到目前为止,我所做的是创建一个gitlab docker runner

gitlab-ci-multi-runner register --url "https://git.example.com/ci" --registration-token xxxx \
     --description "dockertest"  \
     --executor docker \
     --docker-image "php:7.0-apache" \
     --docker-services mariadb:latest
我有一个
.gitlabci.yml

stages:
  - deploy

job-deploy-docker:
  only: 
  - docker-ci-test
  stage: deploy
  environment: docker
  tags:
  - docker
  image: php:7.0-apache
  services:
  - mariadb
  script:
    - apt-get update && apt-get --assume-yes install mysql-client
    - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb -e "create database ci"
部署运行
作业成功
,然后容器被销毁

  • 如何避免破坏容器。当然,如果对分支进行了新的推送,则应该将其清理或重新使用
  • 如何使web应用程序在某个外部URL(branchname.ci.example.com)下可访问
  • 这是正确的方法还是我应该做得不同

  • Gitlab的文档确实提到了这样一个案例:但它缺乏适当的示例。@JakubKania足够有趣了。。。问题是docker是否可以用于此以及如何使用。他们提到我必须为托管设置自己的基础设施-我希望能够(ab)使用gitlab runner的docker设置方法。当然可以使用docker,例如Kubernetes。是的,但这意味着我必须设置Kubernetes基础设施,并将docker文件添加到我的项目中,对吗?我认为如果ci失败,这将非常有用。您可以创建本地运行程序,输入容器并检查问题。我多次看到脚本在mac上工作正常,但在linux上失败的情况。