From 422f36f5239691bcbf57ab22dce42f4589514595 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 26 Nov 2024 14:54:52 +0100 Subject: [PATCH] Reduce redundancy of drone setup --- .../services/drone/docker-compose.core.yml | 23 +++++++++++++ .../drone/docker-compose.templates.yml | 32 +++++++------------ .../Software/docker/services/drone/main.fish | 2 +- 3 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 scripts/Common/Software/docker/services/drone/docker-compose.core.yml diff --git a/scripts/Common/Software/docker/services/drone/docker-compose.core.yml b/scripts/Common/Software/docker/services/drone/docker-compose.core.yml new file mode 100644 index 00000000..e9dbd4a0 --- /dev/null +++ b/scripts/Common/Software/docker/services/drone/docker-compose.core.yml @@ -0,0 +1,23 @@ +services: + ci: + build: + context: . + dockerfile: ci.Dockerfile + restart: unless-stopped + env_file: + - server.common.env + docker: + image: drone/drone-runner-docker + restart: unless-stopped + env_file: runner.common.env + environment: + DRONE_RUNNER_NAME: docker-runner + volumes: + - /var/run/docker.sock:/var/run/docker.sock + ssh: + image: drone/drone-runner-ssh + restart: unless-stopped + env_file: + - runner.common.env + environment: + DRONE_RUNNER_NAME: ssh-runner diff --git a/scripts/Common/Software/docker/services/drone/docker-compose.templates.yml b/scripts/Common/Software/docker/services/drone/docker-compose.templates.yml index 8ac22ce9..4081f610 100644 --- a/scripts/Common/Software/docker/services/drone/docker-compose.templates.yml +++ b/scripts/Common/Software/docker/services/drone/docker-compose.templates.yml @@ -1,27 +1,19 @@ services: ci-template: - build: - context: . - dockerfile: ci.Dockerfile - restart: unless-stopped - env_file: - - server.common.env + extends: + file: docker-compose.core.yml + service: ci + env_file: [] environment: {} docker-template: - image: drone/drone-runner-docker - restart: unless-stopped + extends: + file: docker-compose.core.yml + service: docker depends_on: [] - env_file: - - runner.common.env - environment: - DRONE_RUNNER_NAME: docker-runner - volumes: - - /var/run/docker.sock:/var/run/docker.sock + env_file: [] ssh-template: - image: drone/drone-runner-ssh - restart: unless-stopped + extends: + file: docker-compose.core.yml + service: ssh depends_on: [] - env_file: - - runner.common.env - environment: - DRONE_RUNNER_NAME: ssh-runner + env_file: [] diff --git a/scripts/Common/Software/docker/services/drone/main.fish b/scripts/Common/Software/docker/services/drone/main.fish index 83cd0a53..b85ef6c5 100755 --- a/scripts/Common/Software/docker/services/drone/main.fish +++ b/scripts/Common/Software/docker/services/drone/main.fish @@ -19,7 +19,7 @@ begin echo "{}" | sudo tee "$config" >/dev/null echo "{}" | sudo tee "$secrets" >/dev/null - cp "$dir"/{ci.Dockerfile,.dockerignore} "$root" + cp "$dir"/{ci.Dockerfile,docker-compose.core.yml,.dockerignore} "$root" echo "DRONE_JSONNET_ENABLED=true" | sudo tee "$root/server.common.env" >/dev/null echo "DRONE_RUNNER_CAPACITY=2" | sudo tee "$root/runner.common.env" >/dev/null