<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Cradicle Explorer</title>
    <link href="/css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <style>
      .form-control-dark::placeholder {
          color: #aaa;
          opacity: 1;
      }
    </style>
    <link rel="stylesheet" href="/assets/fontawesome/css/all.min.css">
    <link rel="icon" type="image/png" href="/favicon.png">


                <link href="/css/dashboard.css" rel="stylesheet">
                </head>
                <body>
                <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
                  <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6" href="/">Cradicle Explorer</a>
                  <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                  </button>
                  <form method="get" action="/cgi-bin/main" style="width:100%;"><input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" name="q" placeholder="Search repos" aria-label="Search"></form>
                  <div class="navbar-nav flex-row">
                    <div class="nav-item text-nowrap">
                      <a class="nav-link px-3 active" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu">embark-docker</a>
                    </div>
                  </div>
                </header>
                <div class="container-fluid">
                  <div class="row">
                    <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-dark sidebar collapse">
                      <div class="position-sticky pt-3 sidebar-sticky">
                        <ul class="nav flex-column">
                          <li class="nav-item">
                            <a class="nav-link active" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu">
                              <i class="align-text-bottom fa-solid fa-info"></i>
                              Info
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu&issue=list">
                              <i class="align-text-bottom fa-solid fa-layer-group"></i>
                              Issues
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu&patch=list">
                              <i class="align-text-bottom fa-solid fa-vest-patches"></i>
                              Patches
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu&wallet=list">
                              <i class="align-text-bottom fa-solid fa-wallet"></i>
                              Wallets
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z3xMer15VQmsMcX9EWBv1QUW7fCvu&source=.">
                              <i class="align-text-bottom fa-solid fa-code"></i>
                              Source
                            </a>
                          </li>
                        <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
                          <span></span>
                        </h6>
                        <ul class="nav flex-column mb-2">
                        
                        </ul>
                      </div>
                    </nav>
                <main class="col-md-9 ms-sm-auto col-lg-10">
                  <div class="container px-1 py-3">
        

    <div class="list-group">
    <div class="list-group-item">
    <div style="font-size:1.3rem;">embark-docker</div>
    <div class="repo-item"></div>
    <div>rad:z3xMer15VQmsMcX9EWBv1QUW7fCvu</div>
    </div>
    <div class="list-group-item">
    <div>Visibility</div>
    <div class="repo-item">public</div>
    </div>
    <div class="list-group-item">
    <div>Delegates</div><div class="repo-item">did:key:z6MkuRd31dLXvQTavnVGbZL2jfpKY9rJjSktE89LBa8zAmdp</div>
    </div>
    <div class="list-group-item">
    <div>Default branch</div>
    <div><span class="repo-item">master &#8594 5ddd008a28a26fcee13d831cda7612231e1b5bcb</span> (Thu Oct 25 12:29:25 2018)</div>
    </div>
    <div class="list-group-item">
    <div>Threshold</div>
    <div class="repo-item">1</div>
    </div>
    </div>
    
        <div class="list-group mt-3">
        <div class="list-group-item">
        <div class="mb-2" style="font-weight:bold;"><i class="fa-solid fa-book"></i> README.md</div>
        <pre style="margin:0; font-size:0.85rem; overflow-x:auto; color:#fafafa;"># Embark for Docker

## Quick start

In a Bash shell:
``` shell
source &lt;(curl -L https://bit.ly/run_embark)
run_embark demo
cd embark_demo
run_embark
```

Note that the `run_embark demo` command will create an `embark_demo` directory in
the docker host&#x27;s `$PWD`.

Note if you&#x27;re a macOS user and see `ERROR: this script requires Bash version &gt;= 4.0`, please follow our [Bash upgrade instructions](./macOS-bash4-upgragde.md).

## Usage via `run.sh`

[`run.sh`](https://github.com/embark-framework/embark-docker/blob/master/run.sh)
is a Bash script that simplifies usage of the embark container: publishing
ports, bind mounting a host volume, and so on.

When sourced, `run.sh` makes available a shell function named
`run_embark`. When executed, `run.sh` forwards its arguments to the
`run_embark` shell function.

Many aspects of `run_embark`&#x27;s behavior can be overridden with environment
variables, and that approach can be (optionally) combined with `docker build`.

``` shell
EMBARK_DOCKER_IMAGE=statusim/embark
EMBARK_DOCKER_TAG=develop
EMBARK_DOCKERFILE=&#x27;https://github.com/embark-framework/embark-docker.git#master&#x27;
EMBARK_VERSION=&#x27;embark-framework/embark#develop&#x27;
NODE_VERSION=10.7.0
RUNNER=&#x27;https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh&#x27;

docker build \
       --build-arg EMBARK_VERSION=$EMBARK_VERSION \
       --build-arg NODE_VERSION=$NODE_VERSION \
       -t $EMBARK_DOCKER_IMAGE:$EMBARK_DOCKER_TAG \
       $EMBARK_DOCKERFILE

source &lt;(curl $RUNNER)
run_embark demo
cd embark_demo
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)
for all possible overrides.

It&#x27;s possible to pass additional options to `docker run` by specifying them
before `--`.

``` shell
run_embark [docker-run-opts] -- [command]
```

To completely replace the default `docker run` options:

``` shell
EMBARK_DOCKER_RUN_OPTS_REPLACE=true
run_embark [docker-run-opts] -- [command]
```

By default `run_embark` invokes `docker run` with the
[`--rm`](https://docs.docker.com/engine/reference/run/#clean-up---rm) option,
making the embark container ephemeral, i.e. it will not persist on the docker
host&#x27;s file system after the container exits. To override this behavior:

``` shell
EMBARK_DOCKER_RUN_RM=false
run_embark [docker-run-opts] -- [command]
```

Note that if you have `EMBARK_DOCKER_RUN_OPTS_REPLACE=true`, then `--rm` would
need to be provided in `[docker-run-opts]`, i.e. `EMBARK_DOCKER_RUN_RM` will be
effectively ignored.

### Shortcuts

These are equivalent:

``` shell
run_embark
```
``` shell
run_embark run
```
``` shell
run_embark embark run
```

The following are also equivalent:

``` shell
run_embark demo
```
``` shell
run_embark embark demo
```

The same is true for the rest of the `embark` commands. To see the full list:

``` shell
run_embark --help
```

### Utilities

The container comes equipped with
[`nodeenv`](https://github.com/ekalinin/nodeenv) and
[`nvm`](https://github.com/creationix/nvm). A `default` Node.js environment is
installed via `nodeenv` during image build and placed in
`~embark/.local/nodeenv/default`. The `default` environment is automatically
activated by the container&#x27;s entrypoint.

Both `nodeenv` and `nvm` can be used in
interactive and non-interactive scripts.

#### `nodeenv`

These are equivalent:

``` shell
nodeenv --prebuilt --node 10.7.0 ~/.local/nodeenv/my_node
```
``` shell
simple_nodeenv 10.7.0 my_node
```

Activate and deactivate environments with `nac` and `denac`.

``` shell
nac my_node
```
``` shell
denac
```

Note that `simple_nodeenv` automatically activates an environment after
installation, while `nodeenv` does not.

#### `nvm`

If `nvm` is preferable, it needs to be loaded first.

``` shell
nvm_load
nvm install --latest-npm 8.11.3
```

`nvm deactivate` and `nvm unload` will work as expected. It&#x27;s also possible to
move between `nodeenv` and `nvm` environments without first deactivating or
unloading.

``` shell
nac default
nvm_load &amp;&amp; nvm use v10.7.0
# ^ assuming 10.7.0 is already installed
nac default
```

#### `micro`

The [`micro`](https://github.com/zyedidia/micro) editor is installed during image
build, should you need to edit files within a running container.

#### `install-extras.sh`

Some nice-to-have utilities are not installed by default, but this can be done
by running
[`install-extras.sh`](https://github.com/embark-framework/embark-docker/blob/master/env/install-extras.sh)
as the `root` user in an already running container.

``` shell
docker exec -it $container_id install-extras.sh
```

### Commands

#### Simple

A single command with options can be supplied directly.

``` shell
run_embark bash
```
``` shell
run_embark node -i -e &#x27;console.log(process.version)&#x27;
# ^ press return again to get a blank REPL prompt
```
``` shell
run_embark ps -ef
```

#### Compound

Compound commands should be passed to `bash -[i]c`.

``` shell
run_embark bash -c &#x27;ps -ef &amp;&amp; ls / ; which embark&#x27;
```
``` shell
run_embark bash -c &#x27;nvm_load &amp;&amp; nvm install --latest-npm 8.11.3 &amp;&amp; node --version &amp;&amp; npm --version&#x27;
```

Bash
[here-documents](https://www.gnu.org/software/bash/manual/html_node/Redirections.html#Here-Documents)
can be used to compose scripts without employing an abundance of `&amp;&amp;`, `;`, and
`\`. Just be mindful of umatched quotes and quotes-escaping when building
meta-scripts; in such scenarios, use of
[`envsubst`](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)
is probably called for.

``` shell
run_embark bash -c &#x27;exec bash &lt;&lt; &quot;SCRIPT&quot;

simple_nodeenv 10.7.0 my_node
npm i -g http-server
exec http-server -p 8000

SCRIPT
&#x27;
```

Since `run_embark` mounts the docker host&#x27;s `$PWD` into the container&#x27;s `/dapp`, and
since `/dapp` is the container&#x27;s default working directory, it&#x27;s also possible
to do:

``` shell
run_embark ./my_script.sh
# ^ assuming my_script.sh is in the docker host&#x27;s $PWD
```

Just make sure the script has a `#!` line and that you did `chmod +x
my_script.sh` on the docker host before invoking `run_embark`.

##### `$EMBARK_DOCKER_RUN`

For greater flexibility, you can specify a script with
`$EMBARK_DOCKER_RUN`. Arguments passed to `run_embark` will be forwarded to the
script, and extra flags can be provided to `docker run` to forward docker host
environment variables.

Keep in mind that such scripts will run as the `embark` user owing to the
container&#x27;s entrypoint.

``` shell
#!/bin/bash
# this script is located at /path/to/my_script.sh on the docker host, not necessarily in host&#x27;s $PWD
# dangling &quot;
c=container!
echo $HOST_HOSTNAME
echo $HOSTNAME
echo $@
echo $1
# a comment
echo $2
echo $3
eval echo \$$3
# another comment
```
Invoke with:
``` shell
EMBARK_DOCKER_RUN=/path/to/my_script.sh
a=host!
run_embark -e HOST_HOSTNAME=$HOSTNAME -- $a b c
```

Node.js variant:
``` javascript
#!/usr/bin/env node
// this script is located at /path/to/my_node_script.js on the docker host, not necessarily in host&#x27;s $PWD
const o = {c: &#x27;container!&#x27;};
console.log(process.env.HOST_HOSTNAME);
console.log(process.env.HOSTNAME);
console.log(JSON.stringify(process.argv));
console.log(process.argv[2]);
console.log(process.argv[3]);
console.log(process.argv[4]);
console.log(o[process.argv[4]]);
```
Invoke the same way:
``` shell
EMBARK_DOCKER_RUN=/path/to/my_node_script.js
a=host!
run_embark -e HOST_HOSTNAME=$HOSTNAME -- $a b c
```

#### `docker exec`

When executing compound commands via `docer exec` in a running embark
container, `su-exec` and `bash -[i]c` can be used together.

``` shell
docker exec -it $container_id su-exec embark \
       bash -ic &#x27;exec bash &lt;&lt; &quot;SCRIPT&quot;

simple_nodeenv 10.7.0 my_node || nac my_node
npm i -g http-server
exec http-server -p 8000

SCRIPT
&#x27;
```

To go non-interactive, manually source the embark user&#x27;s `.bash_env`.

``` shell
docker exec -it $container_id su-exec embark \
       bash -c &#x27;exec bash &lt;&lt; &quot;SCRIPT&quot;

. ~/.bash_env
simple_nodeenv 10.7.0 my_node || nac my_node
npm i -g http-server
exec http-server -p 8000

SCRIPT
&#x27;
```

## Container development

### Updating versions

* Open `Dockerfile`
* On the `ARG` directives, update necessary versions.

### Building

Building requires Docker to be installed on your local machine.

#### Scripted

If you have Ruby installed in your system, run:

```
$ ruby script/build
```

To release, add `--release` as a parameter of the build script.

#### Manually

Building and releasing manually isn&#x27;t too hard either, but there are a couple
steps.

##### Tags

To facilitate the images being found, we tag them with the following rules (as
an example, the `3.1.5` version will be used.)

- Tag with `statusim/embark:latest` if `3.1.5` is the latest version.
- Tag with `statusim/embark:3.1.5`
- Tag with `statusim/embark:3.1` if `3.1.5` is the highest patch level on `3.1`
- Tag with `statusim/embark:3` if `3.1.5` is the highest minor and patch level
  on `3`

##### Generating the image

To generate the image, run:

```
docker build . -t statusim/embark:&lt;version&gt; [...tags]
```

### Releasing

Releasing requires that you&#x27;re authenticated to Docker Hub. To do so, run:

```
$ docker login
```

#### Scripted

If you have Ruby installed in your system, run:

```
$ ruby script/build --release
```

#### Manual

Pushing the tags manually implies that the image has been previously built. To
push your local images, run:

```
docker push statusim/embark:version
```
</pre>
        </div>
        </div>

</div>
</main>
</div>
</div>


</body>
</html>

