Skip to content

Commit

Permalink
Do a version compare to support older and newer versions of docker-co…
Browse files Browse the repository at this point in the history
…mpose. (#29)
  • Loading branch information
pingers authored May 1, 2018
1 parent 34b4b04 commit 0eff35f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export NGINX_PORT=$(docker port nginx-proxy | awk -F ':' '{print $2}')

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

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

0 comments on commit 0eff35f

Please sign in to comment.