name: gerrit-lab

services:
  gerrit:
    image: docker.io/gerritcodereview/gerrit:3.14.2@sha256:c1a145a7700909af6a2327b95d8eaeee6a0447745d4364ca3e8f0b84d03ce17f
    restart: unless-stopped
    environment:
      CANONICAL_WEB_URL: ${GERRIT_WEB_URL:?set GERRIT_WEB_URL}
      JAVA_TOOL_OPTIONS: -Xms512m -Xmx2g
    ports:
      - "${GERRIT_BIND_ADDRESS:-127.0.0.1}:${GERRIT_HTTP_PORT:-8081}:8080"
      - "${GERRIT_BIND_ADDRESS:-127.0.0.1}:${GERRIT_SSH_PORT:-29418}:29418"
    volumes:
      - ./data/gerrit_git:/var/gerrit/git
      - ./data/gerrit_index:/var/gerrit/index
      - ./data/gerrit_cache:/var/gerrit/cache
      - ./data/gerrit_db:/var/gerrit/db
      - ./data/gerrit_etc:/var/gerrit/etc
      - ./data/gerrit_data:/var/gerrit/data
      - ./data/gerrit_plugins:/var/gerrit/plugins
    cpus: 2.0
    mem_limit: 3g
    healthcheck:
      test: ["CMD-SHELL", "curl --fail --silent http://localhost:8080/config/server/version >/dev/null"]
      interval: 30s
      timeout: 5s
      start_period: 180s
      retries: 10
    security_opt:
      - no-new-privileges:true
    logging:
      options:
        max-size: "10m"
        max-file: "3"
