Files
rinoa-docker/.gitea/actions/docker-img-pre-pull/action.yml
T
Trez.One 8f61e56744
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Check and Create PR (push) Successful in 19s
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Generate list of added/modified/deleted services (push) Successful in 52s
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Docker Compose Dry Run (push) Failing after 1m51s
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Cloudflare DNS Setup (push) Has been skipped
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Update README & Generate List of Modified Services (push) Has been skipped
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / PR Merge (push) Has been skipped
Gitea Branch PR, Cloudflare DNS, README generation, & Docker Deployment / Docker Compose Deployment (push) Has been skipped
....
2025-10-02 07:53:57 -04:00

59 lines
1.8 KiB
YAML

name: "Pre-pull/build Docker images in parallel"
description: "Prepares services for docker compose dry-run by pulling or building them concurrently"
author: "Your Name <you@example.com>"
inputs:
services:
description: "Space-separated list of docker-compose services"
required: true
runs:
using: "composite"
steps:
- name: Pre-pull/build services
shell: bash
run: |
set -euo pipefail
SERVICES="${{ inputs.services }}"
if [ -z "$SERVICES" ]; then
echo "❌ No services provided. Exiting."
exit 1
fi
echo "Services to process:"
echo "$SERVICES"
for svc in $SERVICES; do
(
echo "🔹 Starting prep for service: $svc"
start_time=$(date +%s)
# Get image name; default to empty string if missing
image=$(docker compose config | yq -r ".services[\"$svc\"].image // \"\"")
# Get build context; default to empty string if missing
build_dir=$(docker compose config | yq -r ".services[\"$svc\"].build.context // \"\"")
if [ -n "$image" ]; then
echo "➡️ Pulling image for $svc: $image"
if ! docker pull "$image"; then
echo "⚠️ Failed to pull image $image for service $svc"
fi
elif [ -n "$build_dir" ]; then
echo "⚙️ Building service: $svc from context: $build_dir"
if ! docker compose build "$svc"; then
echo "⚠️ Failed to build service $svc"
fi
else
echo "⚠️ No image or build context for $svc — skipping"
fi
end_time=$(date +%s)
duration=$((end_time - start_time))
echo "✅ Finished $svc in ${duration}s"
) &
done
wait
echo "🎯 All services processed."