From 98efb08e170090b44b4e3da14ab3f059de71e320 Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Thu, 16 Nov 2023 21:12:55 +0100 Subject: [PATCH] (gradle) Make docker image registry and tag configurable This is to enable running an external repository for production and test. Use the ./gradle -Pdocker-registry=registry.foo.bar -Pdocker-tag=my-tag while building to accomplish this. By default, use 'marginalia' for repository and 'latest' as tag. --- docker-compose-screenshot-bot.yml | 2 +- docker-compose.yml | 22 +++++++++++----------- docker-service-with-dist.gradle | 6 +++--- docker-service.gradle | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docker-compose-screenshot-bot.yml b/docker-compose-screenshot-bot.yml index d442fccf..6ab0ae92 100644 --- a/docker-compose-screenshot-bot.yml +++ b/docker-compose-screenshot-bot.yml @@ -10,7 +10,7 @@ x-svc: &service services: screenshot-capture-tool: <<: *service - image: "marginalia.nu/screenshot-capture-tool" + image: "marginalia/screenshot-capture-tool" container_name: "screenshot-capture-tool" networks: - wmsa diff --git a/docker-compose.yml b/docker-compose.yml index c19c7038..6754a298 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,27 +53,27 @@ x-p2: &partition-2 services: index-service-1: <<: *partition-1 - image: "registry.marginalia.nu/index-service" + image: "marginalia/index-service" container_name: "index-service-1" executor-service-1: <<: *partition-1 - image: "registry.marginalia.nu/executor-service" + image: "marginalia/executor-service" container_name: "executor-service-1" index-service-2: <<: *partition-2 - image: "registry.marginalia.nu/index-service" + image: "marginalia/index-service" container_name: "index-service-2" executor-service-2: <<: *partition-2 - image: "registry.marginalia.nu/executor-service" + image: "marginalia/executor-service" container_name: "executor-service-2" query-service: <<: *service - image: "registry.marginalia.nu/query-service" + image: "marginalia/query-service" container_name: "query-service" search-service: <<: *service - image: "registry.marginalia.nu/search-service" + image: "marginalia/search-service" container_name: "search-service" expose: - 80 @@ -87,7 +87,7 @@ services: - "traefik.http.middlewares.add-public.addprefix.prefix=/public" assistant-service: <<: *service - image: "registry.marginalia.nu/assistant-service" + image: "marginalia/assistant-service" container_name: "assistant-service" expose: - 80 @@ -105,7 +105,7 @@ services: - "traefik.http.middlewares.add-public.addprefix.prefix=/public" api-service: <<: *service - image: "registry.marginalia.nu/api-service" + image: "marginalia/api-service" container_name: "api-service" expose: - "80" @@ -119,7 +119,7 @@ services: - "traefik.http.middlewares.add-public.addprefix.prefix=/public" dating-service: <<: *service - image: "registry.marginalia.nu/dating-service" + image: "marginalia/dating-service" container_name: "dating-service" expose: - 80 @@ -133,7 +133,7 @@ services: - "traefik.http.middlewares.add-public.addprefix.prefix=/public" explorer-service: <<: *service - image: "registry.marginalia.nu/explorer-service" + image: "marginalia/explorer-service" container_name: "explorer-service" expose: - 80 @@ -147,7 +147,7 @@ services: - "traefik.http.middlewares.add-public.addprefix.prefix=/public" control-service: <<: *service - image: "registry.marginalia.nu/control-service" + image: "marginalia/control-service" container_name: "control-service" expose: - 80 diff --git a/docker-service-with-dist.gradle b/docker-service-with-dist.gradle index 032f3d1f..a5de41ae 100644 --- a/docker-service-with-dist.gradle +++ b/docker-service-with-dist.gradle @@ -45,7 +45,9 @@ dockerfileZip { docker { dockerfile = tasks.dockerFile.outputs.files.singleFile - name = 'registry.marginalia.nu/'+application.applicationName+':latest' + + name = (project.hasProperty('docker-registry') ? project.property('docker-registry') : 'marginalia')+'/'+application.applicationName+':'+(project.hasProperty('docker-tag') ? project.property('docker-tag') : 'latest') + files tasks.distTar.outputs, \ project(':code:processes:crawling-process').distTar.outputs, \ project(':code:processes:loading-process').distTar.outputs, \ @@ -53,8 +55,6 @@ docker { project(':code:processes:index-constructor-process').distTar.outputs, \ project(':code:processes:website-adjacencies-calculator').distTar.outputs - tags 'latest' - dependsOn project(':code:processes:crawling-process').distTar dependsOn project(':code:processes:loading-process').distTar dependsOn project(':code:processes:converting-process').distTar diff --git a/docker-service.gradle b/docker-service.gradle index 07a7e6f9..4d53fc5a 100644 --- a/docker-service.gradle +++ b/docker-service.gradle @@ -34,8 +34,8 @@ dockerfileZip { docker { dockerfile = tasks.dockerFile.outputs.files.singleFile - name = 'registry.marginalia.nu/'+application.applicationName+':latest' + + name = (project.hasProperty('docker-registry') ? project.property('docker-registry') : 'marginalia')+'/'+application.applicationName+':' + (project.hasProperty('docker-tag') ? project.property('docker-tag') : 'latest') files tasks.distTar.outputs - tags 'latest' dependsOn tasks.distTar }