Refactor docker-compose build logic and pull policy

- Added conditional '--pull' flag on retry in docker-compose build handler, tied to MODE_UPDATE
- Added 'pull_policy: never' to multiple docker-compose service templates to prevent unwanted image pulls
- Fixed minor formatting issues (e.g. Nextcloud volume spacing, WordPress desktop alignment)

Reference: https://chatgpt.com/share/68b0207a-4d9c-800f-b76f-9515885e5183
This commit is contained in:
2025-08-28 11:25:35 +02:00
parent cb66fb2978
commit dece6228a4
17 changed files with 19 additions and 3 deletions

View File

@@ -41,7 +41,7 @@
set -euo pipefail
docker compose build || {
echo "Retrying without cache and pulling bases...";
docker compose build --no-cache --pull;
docker compose build --no-cache{{ ' --pull' if MODE_UPDATE | bool else ''}};
}
args:
chdir: "{{ docker_compose.directories.instance }}"

View File

@@ -6,6 +6,7 @@
build:
context: .
dockerfile: Dockerfile
pull_policy: never
{% include 'roles/docker-container/templates/base.yml.j2' %}
{% if POSTGRES_EXPOSE_LOCAL %}
ports:

View File

@@ -8,6 +8,7 @@
build:
context: {{ docker_repository_path }}
dockerfile: Dockerfile
pull_policy: never
ports:
- 127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}
volumes:

View File

@@ -26,6 +26,7 @@
REACT_APP_API_URL: "{{ WEB_PROTOCOL }}://{{domains[application_id].api}}" # API-URL des PDS
REACT_APP_SITE_NAME: "{{ PRIMARY_DOMAIN | upper }} - Bluesky"
REACT_APP_SITE_DESCRIPTION: "Decentral Social "
pull_policy: never
ports:
- "127.0.0.1:{{ports.localhost.http['web-app-bluesky_web']}}:8100"
healthcheck:

View File

@@ -4,6 +4,7 @@
build:
context: {{ docker_repository_path }}
dockerfile: Dockerfile
pull_policy: never
image: {{ DESKTOP_IMAGE }}
container_name: {{ DESKTOP_CONTAINER }}
ports:

View File

@@ -4,6 +4,7 @@
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
pull_policy: never
volumes:
- type: bind
source: ./elasticsearch/config/elasticsearch.yml
@@ -27,6 +28,7 @@
context: logstash/
args:
ELK_VERSION: $ELK_VERSION
pull_policy: never
volumes:
- type: bind
source: ./logstash/config/logstash.yml
@@ -51,6 +53,7 @@
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
pull_policy: never
volumes:
- type: bind
source: ./kibana/config/kibana.yml

View File

@@ -10,6 +10,7 @@
build:
context: "{{ docker_repository_path }}"
dockerfile: Dockerfile
pull_policy: never
volumes:
- "{{ mig_roles_meta_volume }}:/usr/share/nginx/html/roles:ro"
- "{{ docker_repository_path }}:/usr/share/nginx/html"

View File

@@ -6,6 +6,7 @@
build:
context: .
dockerfile: Dockerfile
pull_policy: never
image: moodle_custom
ports:
- 127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}

View File

@@ -3,6 +3,7 @@
build:
context: {{ path_infinito_presentation_output.stdout }}
dockerfile: {{ path_infinito_presentation_output.stdout }}/Dockerfile
pull_policy: never
ports:
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:5000"
volumes:

View File

@@ -5,7 +5,7 @@
container_name: {{ NEXTCLOUD_CONTAINER }}
volumes:
- data:{{ NEXTCLOUD_DOCKER_WORK_DIRECTORY }}
- {{nextcloud_host_config_additives_directory}}:{{nextcloud_docker_config_additives_directory}}:ro
- {{ nextcloud_host_config_additives_directory }}:{{ nextcloud_docker_config_additives_directory }}:ro
healthcheck:
test: ["CMD", "su", "www-data", "-s", "/bin/sh", "-c", "php {{ NEXTCLOUD_DOCKER_WORK_DIRECTORY }}occ status"]
interval: 1m

View File

@@ -6,6 +6,7 @@ x-op-app: &app
build:
context: .
dockerfile: Dockerfile
pull_policy: never
{% include 'roles/docker-compose/templates/base.yml.j2' %}

View File

@@ -3,6 +3,7 @@
container_name: roulette_application
build:
context: .
pull_policy: never
ports:
- 127.0.0.1:{{ ports.localhost.http[application_id] }}:8080
restart: {{ DOCKER_RESTART_POLICY }}

View File

@@ -4,6 +4,7 @@
build:
context: {{ path_infinito_sphinx_output.stdout }}
dockerfile: {{ path_infinito_sphinx_output.stdout }}/Dockerfile
pull_policy: never
ports:
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}"
{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %}

View File

@@ -10,7 +10,7 @@ plugins:
features:
matomo: true
css: false
desktop: true
desktop: true
oidc: true
central_database: true
logout: true

View File

@@ -5,6 +5,7 @@
container_name: {{ WORDPRESS_CONTAINER }}
build:
context: .
pull_policy: never
ports:
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
volumes:

View File

@@ -4,6 +4,7 @@
build:
context: {{ docker_repository_path }}
dockerfile: Dockerfile
pull_policy: never
image: logout
container_name: logout
ports:

View File

@@ -3,6 +3,7 @@
build:
context: .
dockerfile: Dockerfile
pull_policy: never
image: simpleicons-server:latest
container_name: simpleicons-server
ports: