Skip to content

Commit 0eff35f

Browse files
authored
Do a version compare to support older and newer versions of docker-compose. (#29)
1 parent 34b4b04 commit 0eff35f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dsh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export NGINX_PORT=$(docker port nginx-proxy | awk -F ':' '{print $2}')
1717

1818
# Used as the prefix for docker networking, container naming and nginx hostname.
1919
export PROJECT=$(basename ${PWD})
20+
# docker-compose stopped stripping chars from project name in 1.21.0.
21+
export DOCKER_COMPOSE_VERSION=$(docker-compose -v | awk '{print $3}' | rev | cut -c 2- | rev)
22+
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
23+
if [ $(version ${DOCKER_COMPOSE_VERSION}) -lt $(version "1.21.0") ]; then
24+
export PROJECT=$(echo ${PROJECT} | sed 's/[-_]//g')
25+
fi
2026

2127
# Determine the OS type of the host machine.
2228
if [ "$(uname)" == "Darwin" ]; then

0 commit comments

Comments
 (0)