mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 10:19:09 +00:00 
			
		
		
		
	fix(docker-compose): proper lock path + robust pull for buildable services
- Store pull lock under ${PATH_DOCKER_COMPOSE_PULL_LOCK_DIR}/<hash>.lock so global cleanup removes it reliably
- If any service defines `build:`, run `docker compose build --pull` before pulling
- Use `docker compose pull --ignore-buildable` when supported; otherwise tolerate pull failures for locally built images
This prevents failures when images are meant to be built locally (e.g., custom images) and ensures lock handling is consistent.
Ref: https://chatgpt.com/share/68b6b592-2250-800f-b68e-b37ae98dbe70
			
			
This commit is contained in:
		| @@ -15,10 +15,17 @@ | ||||
| - name: docker compose pull | ||||
|   shell: | | ||||
|     set -euo pipefail | ||||
|     lock="{{ [ PATH_DOCKER_COMPOSE_PULL_LOCK_DIR, docker_compose.directories.instance ] | path_join | hash('sha1') }}" | ||||
|     lock="{{ [ PATH_DOCKER_COMPOSE_PULL_LOCK_DIR, (docker_compose.directories.instance | hash('sha1')) ~ '.lock' ] | path_join }}" | ||||
|     if [ ! -e "$lock" ]; then | ||||
|       mkdir -p "$(dirname "$lock")" | ||||
|       docker compose pull | ||||
|       if docker compose config | grep -qE '^[[:space:]]+build:'; then | ||||
|         docker compose build --pull | ||||
|       fi | ||||
|       if docker compose pull --help 2>/dev/null | grep -q -- '--ignore-buildable'; then | ||||
|         docker compose pull --ignore-buildable | ||||
|       else | ||||
|         docker compose pull || true | ||||
|       fi | ||||
|       : > "$lock" | ||||
|       echo "pulled" | ||||
|     fi | ||||
|   | ||||
		Reference in New Issue
	
	Block a user