Skip to content

Commit a98c578

Browse files
Peter Markirobertsipka
authored andcommitted
Update README.md with a guide to using Docker (#227)
JSRemoteTest-DCO-1.0-Signed-off-by: Peter Marki [email protected]
1 parent 1d5676b commit a98c578

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- docker
99

1010
before_install:
11-
- if [[ "$RUN_DOCKER" == "yes" ]]; then docker pull iotjs/js_remote_test:0.5; fi
11+
- if [[ "$RUN_DOCKER" == "yes" ]]; then docker pull iotjs/js_remote_test:0.6; fi
1212

1313
install:
1414
- pip install pylint

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,53 @@ $ python -m jstest --device artik053 --app iotjs --device-id /dev/ARTIK053 --bau
239239
```
240240

241241
**Note**: If coverage is enabled then the memory measurement data will not be processed. However, it is shown as an information.
242+
243+
### Run js-remote-test from Docker
244+
245+
`js-remote-test` runs best on Ubuntu systems (especially Ubuntu 16.04). If you have a different distribution and/or you can't install required dependencies, you can use the `iotjs/js_remote_test` docker image.
246+
247+
#### Downloading the Docker image
248+
```sh
249+
$ docker pull iotjs/js_remote_test:0.6
250+
```
251+
252+
#### Starting a Docker container
253+
```sh
254+
$ docker run -dit --user jsuser -w /home/jsuser --name jsremote iotjs/js_remote_test:0.6
255+
```
256+
257+
Possible additional arguments of the `docker run` command:
258+
* `-v`
259+
This argument can be used to mount your js-remote-test folder in the docker container. For example:
260+
```sh
261+
$ docker run -dit --user jsuser -w /home/jsuser --name jsremote -v /home/user/js-remote-test:/home/jsuser/js-remote-test iotjs/js_remote_test:0.6
262+
```
263+
Now you will be able to access your js-remote-test directory in docker at `/home/jsuser/js-remote-test`.
264+
265+
This can also be used to attach serial devices to your container. For example:
266+
```sh
267+
$ docker run -dit --user jsuser -w /home/jsuser --name jsremote -v /dev/ARTIK053:/dev/ARTIK053 iotjs/js_remote_test:0.6
268+
```
269+
This will make `/dev/ARTIK053` visible in the container with the same name. Note: if you unplug the device while the container
270+
is running, it will not work after plugging back in, even though `/dev/ARTIK053` still exists in the container.
271+
272+
* `--env`
273+
This argument can be used to set environment variables in the container. It can be especially useful to set the `PYTHONPATH` variable:
274+
```sh
275+
# Assuming the path to js-remote-test in the container is /home/jsuser/js-remote-test
276+
$ docker run -dit --user jsuser -w /home/jsuser --name jsremote --env PYTHONPATH=/home/jsuser/js-remote-test:$PYTHONPATH iotjs/js_remote_test:0.6
277+
```
278+
279+
#### Executing js-remote-test
280+
You can get a bash prompt ("login" to the container), and then run js-remote-test as usual:
281+
```sh
282+
$ docker exec -it jsremote /bin/bash
283+
# Assuming you are already "logged in" to the container:
284+
$ cd path_to_js_remote_test
285+
$ python -um jstest ...
286+
```
287+
288+
Alternatively, you can also execute `js-remote-test` without logging in (NOTE: for this you need to set the `PYTHONPATH` variable as instructed above.)
289+
```sh
290+
$ docker exec -it jsremote /bin/bash -c python -um jstest ...
291+
```

tools/travis_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
TRAVIS_BUILD_PATH = os.environ['TRAVIS_BUILD_DIR']
2525

26-
DOCKER_IMAGE_NAME = 'iotjs/js_remote_test:0.5'
26+
DOCKER_IMAGE_NAME = 'iotjs/js_remote_test:0.6'
2727
DOCKER_NAME = 'jsremote_docker'
2828
DOCKER_ROOT_PATH = '/root'
2929

0 commit comments

Comments
 (0)