version: "3.8"

# Corrosion Infrastructure Stack (Sovereign Stack)
# Separate from application stack for resilience
# Domains: git.corrosionmgmt.com, cdn.corrosionmgmt.com

services:
  # ---------------------------------------------------------------------------
  # TARGET 1: GITEA (Source Control & CI/CD Hub)
  # Domain: git.corrosionmgmt.com
  # ---------------------------------------------------------------------------
  gitea:
    image: gitea/gitea:latest
    container_name: corrosion-gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8090:3000"  # Web UI (Map to git.corrosionmgmt.com)
      - "8095:22"    # SSH (git clone ssh://git@git.corrosionmgmt.com:8095/...)

  # ---------------------------------------------------------------------------
  # TARGET 2: SEAWEEDFS (S3 Artifact Storage & CDN)
  # Domain: cdn.corrosionmgmt.com
  # ---------------------------------------------------------------------------
  seaweedfs:
    image: chrislusf/seaweedfs:latest
    container_name: corrosion-cdn
    # Running in "server" mode starts Master + Volume + Filer + S3 in one go
    command: "server -s3 -filer -dir=/data -s3.port=8333 -filer.port=8888 -master.port=9333 -volume.port=8080"
    restart: always
    volumes:
      - ./seaweedfs:/data
    ports:
      - "8091:8888" # Filer UI & CDN (Map to cdn.corrosionmgmt.com)
      - "8092:8333" # S3 API (For CI/CD Artifact Uploads)
      - "8093:9333" # Master (Internal Admin)
      - "8094:8080" # Volume (Internal Data)

networks:
  default:
    name: corrosion_infra
