mirror of https://github.com/codevalet/codevalet
33 lines
911 B
Bash
Executable File
33 lines
911 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script is meant to be added to the PATH so the latest azure-cli is
|
|
# always ready to use
|
|
|
|
CONTAINER_NAME=azuresdk/azure-cli-python:latest
|
|
REPO_DIR=$(realpath $(dirname $0)/../)
|
|
|
|
pull_container() {
|
|
docker pull ${CONTAINER_NAME}
|
|
}
|
|
|
|
# Pull down the container if we don't already have it
|
|
docker inspect ${CONTAINER_NAME} 2>&1 > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
pull_container
|
|
fi;
|
|
|
|
# http://blog.dscpl.com.au/2015/12/unknown-user-when-running-docker.html
|
|
# Passing LOGNAME and USER because the acs component in the azure-cli does some
|
|
# user lookup
|
|
|
|
# Disabling --tty because of :
|
|
# https://github.com/docker/docker/issues/8513#issuecomment-90715369
|
|
exec docker run --rm -ti -u $(id -u):$(id -g) \
|
|
-v ${HOME}/.azure:/.azure \
|
|
-v ${HOME}/.ssh:/.ssh \
|
|
-e LOGNAME=$LOGNAME \
|
|
-e USER=$USER \
|
|
-v $PWD:/data \
|
|
--workdir=/data \
|
|
${CONTAINER_NAME} /usr/local/bin/az $@
|