manage, also recognize compose.yml files.
This commit is contained in:
1 parent
94273679d8
commit
623d855cf6
1 file changed
+9
-8
+9
-8
@@ -151,13 +151,14 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
|
|||||||
pwd
|
pwd
|
||||||
|
|
||||||
# Ensure env file exists so that all compose variables are populated.
|
# Ensure env file exists so that all compose variables are populated.
|
||||||
if [[ -e "./example.env" && ! -e "./.env" && -f "docker-compose.yml" ]]; then
|
if [[ -e "./example.env" && ! -e "./.env" &&
|
||||||
|
( -f "docker-compose.yml" || -f "compose.yml" ]]; then
|
||||||
echo "WARNING: .env file was not found, copying example as placeholder."
|
echo "WARNING: .env file was not found, copying example as placeholder."
|
||||||
cp -v example.env .env
|
cp -v example.env .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure all configuration files have been created.
|
# Ensure all configuration files have been created.
|
||||||
if [[ -d "./config" && -f "docker-compose.yml" ]]; then
|
if [[ -d "./config" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
|
||||||
ls ./config/*.example 2>/dev/null | while read example; do
|
ls ./config/*.example 2>/dev/null | while read example; do
|
||||||
real=${example//.example/}
|
real=${example//.example/}
|
||||||
if [[ ! -e $real ]]; then
|
if [[ ! -e $real ]]; then
|
||||||
@@ -168,12 +169,12 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the prep script to create any necessary volumes.
|
# Run the prep script to create any necessary volumes.
|
||||||
if [[ -f "prep.sh" && -f "docker-compose.yml" ]]; then
|
if [[ -f "prep.sh" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
|
||||||
./prep.sh
|
./prep.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run any maintenance scripts associated with the container.
|
# Run any maintenance scripts associated with the container.
|
||||||
if [[ "$maintenance" == "Y" && -f "docker-compose.yml" ]]; then
|
if [[ "$maintenance" == "Y" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
|
||||||
if [[ -f "maintenance.sh" ]]; then
|
if [[ -f "maintenance.sh" ]]; then
|
||||||
./maintenance.sh
|
./maintenance.sh
|
||||||
fi
|
fi
|
||||||
@@ -184,22 +185,22 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
|
|||||||
|
|
||||||
# Update container from remote source such as Docker Hub.
|
# Update container from remote source such as Docker Hub.
|
||||||
if [[ $pull == "Y" ]]; then
|
if [[ $pull == "Y" ]]; then
|
||||||
[ -e docker-compose.yml ] && docker compose pull
|
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose pull
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Execute commands within the container's Dockerfile.
|
# Execute commands within the container's Dockerfile.
|
||||||
if [[ $build == "Y" ]]; then
|
if [[ $build == "Y" ]]; then
|
||||||
[ -e Dockerfile ] && docker compose build
|
[[ -e Dockerfile ]] && docker compose build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut off container.
|
# Shut off container.
|
||||||
if [[ $down == "Y" ]]; then
|
if [[ $down == "Y" ]]; then
|
||||||
[ -e docker-compose.yml ] && docker compose down
|
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose down
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the container as a daemon.
|
# Run the container as a daemon.
|
||||||
if [[ $up == "Y" ]]; then
|
if [[ $up == "Y" ]]; then
|
||||||
[ -e docker-compose.yml ] && docker compose up -d
|
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose up -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
Reference in new issue
Block a user