Skip to content

Instantly share code, notes, and snippets.

@tristan0x
Last active May 31, 2017 09:24
Show Gist options
  • Save tristan0x/a34d483584327b73ff1c to your computer and use it in GitHub Desktop.
Save tristan0x/a34d483584327b73ff1c to your computer and use it in GitHub Desktop.
Docker-compose installer
#!/bin/sh -e
PREFIX=${PREFIX:-/usr}
NAME=${NAME:-docker-compose}
DOCKERCOMPOSE_VERSION=${DOCKERCOMPOSE_VERSION:-1.1.0}
VENV_PATH="${PREFIX}/${NAME}"
VIRTUALENV=${VIRTUALENV:-virtualenv}
if ! [ -d "$PREFIX" ] ; then
echo "Error: work directory '$PREFIX' does not exist. Abort." >&2
exit 1
elif [ -d "$VENV_PATH" ] ; then
echo "Error: docker-compose virtualenv directory already exists: '$VENV_PATH'. Abort."
exit 1
fi
echo "checking tool virtualenv: "
${VIRTUALENV} --version
${VIRTUALENV} ${VENV_PATH}
. ${VENV_PATH}/bin/activate
pip install "requests==2.4.3"
pip install "docker-compose==${DOCKERCOMPOSE_VERSION}"
cat <<EOF
docker-compose has been installed, version: `docker-compose --version`
You should add a DOCKER_COMPOSE environment variable
in your favorite shell configuration:
Bourne shell
------------
export DOCKER_COMPOSE="`which docker-compose`"
C-Shell
-------
setenv DOCKER_COMPOSE "`which docker-compose`"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment