services:
  #sonar:
  #  image: sonarqube:community
  #  container_name: sonar2
  #  ports:
  #    - "127.0.0.1:9002:9000"
  #  restart: unless-stopped
  #  networks:
  #    - jenkins
  #  volumes:
  #    - sonarqube-jenkins:/opt/sonarqube/data
  #    - sonarqube-jenkins:/opt/sonarqube/extensions
  #    - sonarqube-jenkins:/opt/sonarqube/logs
  jenkins:
    image: jenkins-docker:latest
    container_name: jenkins
    ports:
      - "127.0.0.1:8080:8080"   # Jenkins UI
      - "127.0.0.1:50000:50000" # Jenkins agent
    volumes:
      - jenkins-data:/var/jenkins_home
      - jenkins-docker-certs:/certs/client:ro
    environment:
      DOCKER_HOST: tcp://docker:2376
      DOCKER_TLS_VERIFY: 1
      DOCKER_CERT_PATH: /certs/client
    restart: unless-stopped
    networks:
      - jenkins
  docker:
    image: docker:dind
    container_name: jenkins-docker2
    privileged: true
    environment:
      DOCKER_TLS_CERTDIR: /certs
    networks:
      jenkins:
        aliases:
          - docker
    volumes:
      - jenkins-docker-certs:/certs/client
      - jenkins-data:/var/jenkins_home
    command: ["--storage-driver", "overlay2"]
    restart: unless-stopped

volumes:
  jenkins-docker-certs:
  jenkins-data:
  #sonarqube-jenkins:

networks:
  jenkins:
    driver: bridge

