shortcuts

This commit is contained in:
Michael Bradley, Jr 2018-07-24 22:27:03 -05:00
parent 987799ff47
commit 93bea147ce
2 changed files with 43 additions and 7 deletions

View File

@ -5,9 +5,9 @@
In a Bash shell: In a Bash shell:
``` shell ``` shell
source <(curl 'https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh') source <(curl 'https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh')
run_embark_docker embark demo run_embark demo
cd embark_demo cd embark_demo
run_embark_docker run_embark
``` ```
With overrides: With overrides:
@ -28,13 +28,42 @@ docker build \
$EMBARK_DOCKERFILE $EMBARK_DOCKERFILE
source <(curl $RUNNER) source <(curl $RUNNER)
run_embark_docker embark demo run_embark demo
cd embark_demo cd embark_demo
run_embark_docker run_embark
``` ```
Review the [Dockerfile](https://github.com/embark-framework/embark-docker/blob/master/Dockerfile) and [run.sh](https://github.com/embark-framework/embark-docker/blob/master/run.sh#L66-L70) for all possible overrides. Review the [Dockerfile](https://github.com/embark-framework/embark-docker/blob/master/Dockerfile) and [run.sh](https://github.com/embark-framework/embark-docker/blob/master/run.sh#L66-L70) for all possible overrides.
### Shortcuts
The following are equivalent:
``` shell
run_embark demo
```
``` shell
run_embark embark demo
```
These are also equivlent:
``` shell
run_embark
```
``` shell
run_embark embark run
```
Other `embark` commands and non-embark commands should be indicated explicitly:
``` shell
run_embark embark version
```
``` shell
run_embark ps -ef
```
## Updating versions ## Updating versions
* Open `Dockerfile` * Open `Dockerfile`

13
run.sh
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
run_embark_docker () { run_embark () {
local oldopts="" local oldopts=""
case $- in case $- in
*e*) oldopts="set -e";; *e*) oldopts="set -e";;
@ -69,6 +69,13 @@ run_embark_docker () {
local EMBARK_DOCKER_IMAGE=${EMBARK_DOCKER_IMAGE:-statusim/embark} local EMBARK_DOCKER_IMAGE=${EMBARK_DOCKER_IMAGE:-statusim/embark}
local EMBARK_DOCKER_TAG=${EMBARK_DOCKER_TAG:-latest} local EMBARK_DOCKER_TAG=${EMBARK_DOCKER_TAG:-latest}
local -a cmd=
if [[ "$1" = "demo" ]]; then
cmd=( $(echo "embark $@") )
else
cmd=( $(echo "$@") )
fi
docker run \ docker run \
-it \ -it \
-p 5001:5001 \ -p 5001:5001 \
@ -85,7 +92,7 @@ run_embark_docker () {
-e TERM \ -e TERM \
"${EMBARK_DOCKER_EXTRA_RUN_OPTS}" \ "${EMBARK_DOCKER_EXTRA_RUN_OPTS}" \
${EMBARK_DOCKER_IMAGE}:${EMBARK_DOCKER_TAG} \ ${EMBARK_DOCKER_IMAGE}:${EMBARK_DOCKER_TAG} \
"$@" "${cmd[@]}"
local docker_exit_status=$? local docker_exit_status=$?
@ -103,5 +110,5 @@ run_embark_docker () {
} }
if [[ "$0" = "$BASH_SOURCE" ]]; then if [[ "$0" = "$BASH_SOURCE" ]]; then
run_embark_docker "$@" run_embark "$@"
fi fi