美文网首页
docker-compose CI

docker-compose CI

作者: _str_ | 来源:发表于2019-11-21 20:28 被阅读0次

    配置好docker-compos来启动gitlab、jenkins这两个容器

    version: '3.2'
    services:
      gitlab:
        image: gitlab-ce:1.0
        restart: always
        hostname: 'gitlab.qfedu.com'
        environment:
          GITLAB_OMNIBUS_CONFIG: |
            external_url 'http://10.0.122.178:80'     --这里的端口是容器的映射出来的端口  与下面的ports映射出来的端口保持一致 访问的时候是宿主机映射进去的端口
            unicorn['worker_timeout'] = 60
            unicorn['worker_processes'] = 3 # worker进程数
            unicorn['worker_memory_limit_min'] = "200 * 1 << 20" # worker最小内存
            unicorn['worker_memory_limit_max'] = "300 * 1 << 20"  # worker最大内存
            sidekiq['concurrency'] = 10
            postgresql['shared_buffers'] = "128MB"
            postgresql['max_worker_processes'] = 8
        networks:
          - jumpserver-test
        ports:
          - '9280:80'
        volumes:
          - './gitlab/config:/etc/gitlab'
          - './gitlab/logs:/var/log/gitlab'
          - './gitlab/data:/var/opt/gitlab'
    
      jenkins:
        image: jenkinsci/blueocean
        restart: always
        privileged: true
        user: root
        volumes:
          - type: bind
            source: ./jenkins/jenkins_home
            target: /var/jenkins_home
          - type: bind
            source: /var/run/docker/docker.sock
            target: /var/run/docker.sock
            read_only: "yes"
        networks:
          - jumpserver-test
        ports:
          - "9980:8080"
    
    networks:
      jumpserver-test:
    
    

    目录结构:

    image.png
    除了docker-compose.yml文件的两个文件需要都是root的属主和属组

    创建一个jenkins的webhook任务

    image.png image.png image.png

    gitlab设置

    进入要被构建的项目

    image.png image.png

    构建状态

    image.png image.png

    解决本地jenkins使用web钩子失败的问题


    image.png image.png image.png

    相关文章

      网友评论

          本文标题:docker-compose CI

          本文链接:https://www.haomeiwen.com/subject/ftzrictx.html