version: '3.8'

services:
  log:
    image: goharbor/harbor-log:v2.9.0
    container_name: harbor-log
    restart: always
    volumes:
      - ./log/:/var/log/docker/:z
      - ./common/config/log/logrotate.conf:/etc/logrotate.d/logrotate.conf:z
    ports:
      - 127.0.0.1:1514:10514
    networks:
      - harbor

  registry:
    image: goharbor/registry-photon:v2.9.0
    container_name: harbor-registry
    restart: always
    volumes:
      - ./data/registry:/storage:z
      - ./common/config/registry/:/etc/registry/:z
    depends_on:
      - log
    networks:
      - harbor

  registryctl:
    image: goharbor/harbor-registryctl:v2.9.0
    container_name: harbor-registryctl
    restart: always
    volumes:
      - ./data/registry:/storage:z
      - ./common/config/registry/:/etc/registry/:z
      - ./common/config/registryctl/config.yml:/etc/registryctl/config.yml:z
    depends_on:
      - log
    networks:
      - harbor

  postgresql:
    image: goharbor/harbor-db:v2.9.0
    container_name: harbor-db
    restart: always
    volumes:
      - ./database:/var/lib/postgresql/data:z
    environment:
      POSTGRES_PASSWORD: changeit
    networks:
      - harbor

  core:
    image: goharbor/harbor-core:v2.9.0
    container_name: harbor-core
    restart: always
    volumes:
      - ./common/config/core/:/etc/core/:z
      - ./data/ca_download/:/etc/core/ca/:z
      - ./data/:/data/:z
    environment:
      CORE_SECRET: changeit-core-secret
      JOBSERVICE_SECRET: changeit-jobservice-secret
    depends_on:
      - log
      - registry
      - postgresql
    networks:
      - harbor

  portal:
    image: goharbor/harbor-portal:v2.9.0
    container_name: harbor-portal
    restart: always
    depends_on:
      - core
    networks:
      - harbor

  jobservice:
    image: goharbor/harbor-jobservice:v2.9.0
    container_name: harbor-jobservice
    restart: always
    volumes:
      - ./data/job_logs:/var/log/jobs:z
      - ./common/config/jobservice/config.yml:/etc/jobservice/config.yml:z
    environment:
      CORE_SECRET: changeit-core-secret
      JOBSERVICE_SECRET: changeit-jobservice-secret
    depends_on:
      - core
    networks:
      - harbor

  nginx:
    image: goharbor/nginx-photon:v2.9.0
    container_name: harbor-nginx
    restart: always
    volumes:
      - ./common/config/nginx:/etc/nginx:z
      - ./data/secret/cert:/etc/cert:z
    ports:
      - 80:8080
      - 443:8443
    depends_on:
      - postgresql
      - registry
      - core
      - portal
    networks:
      - harbor

  trivy:
    image: goharbor/trivy-adapter-photon:v2.9.0
    container_name: harbor-trivy
    restart: always
    volumes:
      - ./data/trivy-adapter/trivy:/home/scanner/.cache/trivy:z
      - ./common/config/trivy-adapter/env:/etc/scanner/trivy-adapter/env:z
    depends_on:
      - log
    networks:
      - harbor

networks:
  harbor:
    driver: bridge
