mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-21 03:40:39 +00:00
Update dockcheck.sh
Added condition based on the contents of the `com.docker.compose.project.config_files` label.
This commit is contained in:
+9
-4
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
VERSION="v0.1.5"
|
VERSION="v0.1.4"
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
|
|
||||||
### Check if there's a new release of the script:
|
### Check if there's a new release of the script:
|
||||||
@@ -143,8 +143,14 @@ if [ -n "$GotUpdates" ] ; then
|
|||||||
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
|
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
|
||||||
ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
|
ContConfigFile=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files" }}')
|
||||||
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
|
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
|
||||||
$DockerBin -f "$ContPath/$ContConfigFile" pull "$ContName"
|
### Checking if "com.docker.compose.project.config_files" returns the full path to the config file or just the file name
|
||||||
$DockerBin -f "$ContPath/$ContConfigFile" up -d "$ContName"
|
if [[ $ContConfigFile = '/'* ]] ; then
|
||||||
|
ComposeFile="$ContConfigFile"
|
||||||
|
else
|
||||||
|
ComposeFile="$ContPath/$ContConfigFile"
|
||||||
|
fi
|
||||||
|
$DockerBin -f "$ComposeFile" pull "$ContName"
|
||||||
|
$DockerBin -f "$ComposeFile" up -d "$ContName"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
printf "\nNo updates installed, exiting.\n"
|
printf "\nNo updates installed, exiting.\n"
|
||||||
@@ -154,4 +160,3 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user