tty workaround (side benefit: cleaner RUN scripts)

This commit is contained in:
Michael Bradley, Jr 2018-08-07 19:59:59 -05:00
parent 8b690aee1c
commit 4f098d4fa8
4 changed files with 21 additions and 13 deletions

View File

@ -34,7 +34,9 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& dpkg-reconfigure locales \
&& update-locale LANG=${__LANG} LANGUAGE=${__LANGUAGE} LC_ALL=${__LC_ALL} \
&& unset DEBIAN_FRONTEND \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/share/terminfo/d \
&& ln -s /lib/terminfo/d/dumb /usr/share/terminfo/d/dumb
ENV LANG=${__LANG}
SHELL ["/bin/sh", "-c"]
@ -93,6 +95,7 @@ ARG NPM_VERSION
ARG NVM_VERSION
SHELL ["/bin/bash", "-c"]
RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
&& usermod -a -G tty embark \
&& mkdir -p /dapp \
&& chown embark:embark /dapp \
&& curl -fsSLO --compressed "https://bootstrap.pypa.io/get-pip.py" \

View File

@ -261,7 +261,7 @@ echo $1
# a comment
echo $2
echo $3
eval echo \\\$\$3
eval echo \$$3
# another comment
```
Invoke with:

View File

@ -3,4 +3,5 @@
export BASH_ENV=/home/embark/.bash_env
chmod a+w /dev/std*
chmod g+r /dev/pts/0
exec su-exec embark user-entrypoint.sh "$@"

14
run.sh
View File

@ -141,17 +141,21 @@ run_embark () {
fi
local run_script=$(< "$EMBARK_DOCKER_RUN")
# do not add indentation to lines below
run_script="exec bash -s ${cmd[@]} << 'SCRIPT'
# do not alter indentation, tabs in lines below
run_script=$(cat <<- RUN_SCRIPT
exec bash -${i_flag}s \$(tty) ${cmd[@]} << 'SCRIPT'
__tty=\$1
shift
td=\$(mktemp -d)
cat << 'RUN' > \$td/run_script
$run_script
RUN
chmod +x \$td/run_script
exec \$td/run_script \$@
exec \$td/run_script \$@ < \$__tty
SCRIPT
"
# do not add indentation to lines above
RUN_SCRIPT
)
# do not alter indentation, tabs in lines above
cmd=( "bash" "-${i_flag}c" "$run_script" )
fi