搭建常见测试工具环境的docker脚本

整理资料的时候发现一些干货,以下为搭建Jenkins、Registry、SVN、GIT、SonarQube、OpenSTF等测试环境的docker脚本,对docker不熟的同学可自行百度docker-compose,持续更新。

用法及注意事项

1,需要Linux,并安装docker及docker-compose
2,将配置文件保存为文件,比如jenkins.yml
3,使用命令启动相关工具,比如:
[CentOS]# docker-compose -f jenkins.yml up -d

Jenkins

version: "3"
services:
  jenkins:
    environment:
      - "TZ=Asia/Shanghai"
    container_name: jenkins
    image: ${REPO:-docker.io}/ravihuang/jenkins
    ports:
      - "80:8080"
      - "50000:50000"
    restart: always
    volumes:
      - "jenkins:/var/jenkins_home"  
volumes:
  jenkins:

Docker Registry

docker本地仓库:

version: "3"
services:
  registry:
    container_name: registry
    image: ${REPO:-docker.io}/registry:latest
    ports:
      - "5000:5000"
    restart: always
    volumes:
      - "registry:/var/lib/registry"
volumes:
  registry:

配置管理工具(SCM)

这是git和svn二合一的,你喜欢用哪个?

version: "3"
services:
  svn:
    image: ${REPO:-docker.io}/mamohr/subversion-edge
    hostname: "${HOSTNAME-localhost}"
    ports:
      - "3343:3343"
      - "4434:4434" 
      - "18080:18080"
    restart: always
    volumes:
      - "svn:/opt/csvn/data"
  git:
    image: ${REPO:-docker.io}/gitlab/gitlab-ce
    privileged: true
    hostname: "${HOSTNAME-localhost}"
    ports:
      - "443:443"
      - "80:80"
    restart: always
    volumes:
      - "gitlab-config:/etc/gitlab"
      - "gitlab-log:/var/log/gitlab"
      - "gitlab-data:/var/opt/gitlab"

volumes:
  svn:
  gitlab-config:
  gitlab-log:
  gitlab-data:

SonarQube

静态测试工具:

version: "3"

services:
  sonarqube:
    image: ${REPO:-docker.io}/sonarqube
    ports:
      - "9000:9000"
      - "9092:9092"
    restart: always
    networks:
      - sonarnet
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
    volumes:
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins

  db:
    image: ${REPO:-docker.io}/postgres
    restart: always
    networks:
      - sonarnet
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

networks:
  sonarnet:
    driver: bridge

volumes:
  sonarqube_conf:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_bundled-plugins:
  postgresql:
  postgresql_data:

OpenSTF

android手机测试农场,需要自行修改下面的public-ip:

version: "3"
services:
  rethinkdb:
    image: ${REPO:-docker.io}/rethinkdb:2.3
    ports:
      - "8080:8080"
    restart: always
    volumes:
      - "rethinkdb:/data"
    command: "rethinkdb --bind all --cache-size 2048"
  adbd:
    image: ${REPO:-docker.io}/sorccu/adb
    privileged: true
    ports:
      - "5037:5037"
    restart: always
    volumes:
      - "/dev/bus/usb:/dev/bus/usb"
  stf:
    image: ${REPO:-docker.io}/ravihuang/stf
    privileged: true
    environment:
      - RETHINKDB_PORT_28015_TCP=tcp://rethinkdb:28015
    ports:
      - "7100:7100"
      - "7110:7110"
      - "7120:7120"
      - "7400-7500:7400-7500"
    restart: always
    command: stf local --allow-remote --public-ip 192.168.117.155 --provider-min-port 7400 --provider-max-port 7500 --adb-host adbd
    depends_on:
      - rethinkdb

volumes:
  rethinkdb:
    原文作者:testerq
    原文地址: https://segmentfault.com/a/1190000016407609
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞