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 set -euo pipefail
docker compose build || { docker compose build || {
echo "Retrying without cache and pulling bases..."; 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: args:
chdir: "{{ docker_compose.directories.instance }}" chdir: "{{ docker_compose.directories.instance }}"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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