networks: test-net: driver: bridge name: gitops-test-network volumes: # Erzeugt die Ordner lokal und korrigiert automatisch die Docker-Berechtigungen forgejo-data: driver: local driver_opts: type: none o: bind device: ${PWD}/forgejo_data runner-data: driver: local driver_opts: type: none o: bind device: ${PWD}/runner_data services: # 1. FORGEJO (Git Server + Registry) forgejo: image: data.forgejo.org/forgejo/forgejo:9 container_name: forgejo networks: - test-net environment: - FORGEJO__SERVER__HTTP_PORT=3000 - FORGEJO__SERVER__ROOT_URL=http://localhost:3000 - FORGEJO__ACTIONS__ENABLED=true - FORGEJO__PACKAGES__ENABLED=true - FORGEJO__PACKAGES__CONTAINER_ENABLED=true ports: - "3000:3000" - "3005:3000" - "2222:22" volumes: - forgejo-data:/data # Nutzt das sichere Named-Volume restart: always # 2. FORGEJO RUNNER (Pipeline-Ausführung) forgejo-runner: image: data.forgejo.org/forgejo/runner:9 container_name: forgejo-runner networks: - test-net entrypoint: ["/bin/sh", "-c"] command: ["forgejo-runner daemon"] #command: ["tail -f /dev/null"] environment: - GITEA_INSTANCE_URL=http://forgejo:3000 - GITEA_RUNNER_REGISTRATION_TOKEN=z6xlwg3dSRYZ59zUxfrztDJasG6VkvulFyTwtJQS - GITEA_RUNNER_NAME=debian-local-runner - GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bullseye,debian-stable:docker://debian:stable-slim volumes: - /var/run/docker.sock:/var/run/docker.sock - runner-data:/data depends_on: - forgejo restart: always # 3. KUBERNETES INITIALIZER (Flüchtiger Test-Cluster) kind-cluster: image: alpine:latest container_name: gitops-test-control-plane networks: - test-net volumes: - /var/run/docker.sock:/var/run/docker.sock - ./kind_kubeconfig:/output_kubeconfig entrypoint: > sh -c "apk add --no-cache curl docker-cli; curl -sfL https://k8s.io -o /usr/local/bin/kind; chmod +x /usr/local/bin/kind; if ! /usr/local/bin/kind get clusters 2>/dev/null | grep -q gitops-test; then /usr/local/bin/kind create cluster --name gitops-test --image kindest/node:v1.28.0; fi; /usr/local/bin/kind get kubeconfig --name gitops-test > /output_kubeconfig/config; tail -f /dev/null" restart: always