Skip to content

Commit

Permalink
add --no-tty option
Browse files Browse the repository at this point in the history
  • Loading branch information
devosc committed Apr 21, 2020
1 parent 10803a0 commit 0a04df8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/docker-php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ composer_dir="-v ${COMPOSER_DIR}:/home/app/.composer"
directory="$(pwd)"
extra_hosts="${EXTRA_HOSTS}"
hosts=""
tty="-t"
name="php-docker-project-cli"
network=""
no_cache=""
Expand Down Expand Up @@ -38,6 +39,7 @@ Options:
--build Build image from Dockerfile.
--network NAME Name of network to connect the container to, e.g. traefik_webgateway.
--no-cache Do not use cache when building the image.
--no-tty Do not allocate a pseudo-TTY.
--project-directory PATH Alternative working directory, default is current directory.
--ssh-keys Mount user ssh directory."
exit
Expand Down Expand Up @@ -65,6 +67,9 @@ for ((i=0; i < "$#"; ++i)); do
--ssh-keys ) ssh_dir="-v ${HOME}/.ssh:/home/app/.ssh"
unset "args[i]"
;;
--no-tty ) tty=""
unset "args[i]"
;;
esac
done

Expand Down Expand Up @@ -120,4 +125,4 @@ if [[ -z "${hosts}" ]] && [[ -n "${extra_hosts}" ]]; then
done
fi

docker run -it --rm --name "${name}" ${hosts} -v "${volume}" ${network} ${ssh_dir} ${composer_dir} -w "${work_dir}" -u "${user}" "${image}" ${cmd} "${args[@]}"
docker run -i ${tty} --rm --name "${name}" ${hosts} -v "${volume}" ${network} ${ssh_dir} ${composer_dir} -w "${work_dir}" -u "${user}" "${image}" ${cmd} "${args[@]}"

0 comments on commit 0a04df8

Please sign in to comment.