v2-d.jpg

version: "3.7"

networks:
  sonarqubenet:
    external: false
    name: sonarqubenet

# volumes:
#   sonarqubedata:
#     name: sonarqubedata

services:
  sonarqube:
    image: sonarqube:8.1-community-beta
    container_name: sonarqube
    restart: always
    volumes:
      - ./sonarqube/conf:/opt/sonarqube/conf
      - ./sonarqube/data:/opt/sonarqube/data
      - ./sonarqube/logs:/opt/sonarqube/logs
      - ./sonarqube/extensions:/opt/sonarqube/extensions
    ports:
      - 9001:9000
    env_file: .env
    environment:
      # - sonar.jdbc.url=jdbc:postgresql://sonarqube_postgres/{POSTGRES_DB}
      # - sonar.jdbc.username={POSTGRES_USER}
      # - sonar.jdbc.password={POSTGRES_PASSWORD}
      - sonar.jdbc.username=sonar
      - sonar.jdbc.password=sonar
      - sonar.jdbc.url=jdbc:postgresql://sonarqube_postgres/sonar
    # command: ["--init"]
    networks:
      - sonarqubenet
    depends_on:
      - sonarqube_postgres

  # gitea 可以用postgres也可以用mysql
  sonarqube_postgres:
    image: postgres:alpine
    ports:
      - 5432:5432
    restart: always
    container_name: sonarqube_postgres
    volumes:
      - ./postgres/data:/var/lib/postgresql/data
    env_file: .env
    # environment:
    #   - POSTGRES_USER={POSTGRES_USER}
    #   - POSTGRES_PASSWORD={POSTGRES_PASSWORD}
    #   - POSTGRES_DB={POSTGRES_DB}
    networks:
      sonarqubenet:

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code