Files
Scripts/docker/upme
vince f143d0782d Updated UPME
Changed UPME to recursively loop through all folders inside of /compose and added pruning of docker to the end of the script.
2024-03-19 18:31:12 -06:00

31 lines
885 B
Bash

#!/bin/bash
# Define the base directory to iterate through
base_dir="/compose"
# Function to process each directory
process_directory() {
for dir in "$1"/*; do
if [ -d "$dir" ]; then
echo "Processing $dir"
# Change to the directory
cd "$dir" || exit
# Pull the docker compose, suppressing stdout and stderr
docker compose pull
docker compose up -d --remove-orphans
# Go back to the previous directory
cd - > /dev/null 2>&1
# Recursively process subdirectories
process_directory "$dir"
fi
done
}
# Start processing from the base directory
process_directory "$base_dir"
# After processing all directories, run docker system prune
echo "Running docker system prune --volumes -af"
docker system prune --volumes -af
echo "Process completed."