Merge pull request #5 from embark-framework/features/tty-workaround

tty workaround (side benefit: cleaner RUN scripts)
This commit is contained in:
Iuri Matias 2018-08-10 09:10:36 -04:00 committed by GitHub
commit 048770148a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 20 deletions

View File

@ -34,7 +34,9 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& dpkg-reconfigure locales \ && dpkg-reconfigure locales \
&& update-locale LANG=${__LANG} LANGUAGE=${__LANGUAGE} LC_ALL=${__LC_ALL} \ && update-locale LANG=${__LANG} LANGUAGE=${__LANGUAGE} LC_ALL=${__LC_ALL} \
&& unset DEBIAN_FRONTEND \ && 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} ENV LANG=${__LANG}
SHELL ["/bin/sh", "-c"] SHELL ["/bin/sh", "-c"]
@ -93,6 +95,7 @@ ARG NPM_VERSION
ARG NVM_VERSION ARG NVM_VERSION
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \ RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
&& usermod -a -G tty embark \
&& mkdir -p /dapp \ && mkdir -p /dapp \
&& chown embark:embark /dapp \ && chown embark:embark /dapp \
&& curl -fsSLO --compressed "https://bootstrap.pypa.io/get-pip.py" \ && curl -fsSLO --compressed "https://bootstrap.pypa.io/get-pip.py" \

View File

@ -27,12 +27,12 @@ Many aspects of `run_embark`'s behavior can be overridden with environment
variables, and that approach can be (optionally) combined with `docker build`. variables, and that approach can be (optionally) combined with `docker build`.
``` shell ``` shell
export EMBARK_DOCKER_IMAGE=statusim/embark EMBARK_DOCKER_IMAGE=statusim/embark
export EMBARK_DOCKER_TAG=develop EMBARK_DOCKER_TAG=develop
export EMBARK_DOCKERFILE='https://github.com/embark-framework/embark-docker.git#master' EMBARK_DOCKERFILE='https://github.com/embark-framework/embark-docker.git#master'
export EMBARK_VERSION='embark-framework/embark#develop' EMBARK_VERSION='embark-framework/embark#develop'
export NODE_VERSION=10.7.0 NODE_VERSION=10.7.0
export RUNNER='https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh' RUNNER='https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh'
docker build \ docker build \
--build-arg EMBARK_VERSION=$EMBARK_VERSION \ --build-arg EMBARK_VERSION=$EMBARK_VERSION \
@ -261,7 +261,7 @@ echo $1
# a comment # a comment
echo $2 echo $2
echo $3 echo $3
eval echo \\\$\$3 eval echo \$$3
# another comment # another comment
``` ```
Invoke with: Invoke with:

4
env/.bash_env vendored
View File

@ -126,4 +126,6 @@ __versions_export () {
} }
export -f __versions_export export -f __versions_export
nac default if [[ ! -v NODE_VIRTUAL_ENV ]]; then
nac default
fi

View File

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

26
run.sh
View File

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