83 lines
2.0 KiB
Bash
Executable File
83 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define the path to the .env file (root-level)
|
|
ENV_FILE="/mnt/docker/.env"
|
|
|
|
# Base directory where the service Compose files are located
|
|
COMPOSE_DIR="/mnt/docker/docker-compose.d"
|
|
|
|
# List of service directories under docker-compose.d
|
|
services=(
|
|
"Documentation/bookstack.yml"
|
|
"Documentation/gitea.yml"
|
|
"Documentation/vaultwarden.yml"
|
|
"Media/arr.yml"
|
|
"Media/continuwuity.yml"
|
|
"Media/coturn.yml"
|
|
"Media/jellyfin.yml"
|
|
"Media/shoko.yml"
|
|
"Networking/caddy.yml"
|
|
"Networking/ddns.yml"
|
|
"Networking/omada.yml"
|
|
"Networking/technitium.yml"
|
|
"Tools/actual.yml"
|
|
"Tools/ariang.yml"
|
|
"Tools/monerod.yml"
|
|
"Tools/nextcloud-aio.yml"
|
|
"Tools/open-webui.yml"
|
|
"Tools/p2pool.yml"
|
|
"Tools/pastefy.yml"
|
|
"Tools/qbit.yml"
|
|
"Tools/redbot.yml"
|
|
"Tools/searxng.yml"
|
|
"Tools/sftpgo.yml"
|
|
"pterodactyl/docker-compose.yml"
|
|
)
|
|
|
|
# Initialize update flag
|
|
UPDATE=false
|
|
|
|
# Parse command line arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-u|--update)
|
|
UPDATE=true
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
echo "Usage: $0 [-u|--update]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Start building the docker compose command with multiple -f flags
|
|
COMPOSE_COMMAND="docker compose --env-file \"$ENV_FILE\""
|
|
|
|
# Loop through each service and append the -f flag for each compose file
|
|
for service in "${services[@]}"; do
|
|
COMPOSE_COMMAND+=" -f \"$COMPOSE_DIR/$service\""
|
|
done
|
|
|
|
# If update flag is set, pull all images first
|
|
if $UPDATE; then
|
|
COMPOSE_UPDATE_COMMAND="$COMPOSE_COMMAND pull"
|
|
echo "Pulling latest images..."
|
|
eval $COMPOSE_UPDATE_COMMAND
|
|
echo "Images pulled successfully."
|
|
echo ""
|
|
fi
|
|
|
|
# Add the up command to the final docker compose command
|
|
COMPOSE_COMMAND+=" --profile panel --profile daemon up -d --remove-orphans"
|
|
|
|
# Execute the composed command
|
|
eval $COMPOSE_COMMAND
|
|
|
|
if $UPDATE; then
|
|
echo "All containers have been updated and started."
|
|
else
|
|
echo "All services have been started."
|
|
fi
|