Skip to content

Commit 19bcf78

Browse files
committed
Add docker-related docs
1 parent fa1f46a commit 19bcf78

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

docs/index.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,49 @@ examples generated with `pyp5js`.
3333

3434
## Installation
3535

36-
This project requires Python 3 and is now on PyPI, so you can install it with
37-
`pip` or `pip3`, depending on your environment:
36+
You can chosse between using pip or docker:
37+
38+
### Using pip
39+
40+
This project requires Python3 and is available on PyPI, so you can install it
41+
with `pip` or `pip3`, depending on your environment:
3842

3943
```
4044
$ pip install pyp5js
4145
```
46+
4247
(You might have to install `setuptools` first, if it's not already installed)
4348

49+
### Using docker
50+
51+
If you have [docker](https://docker.io/) already installed, just run:
52+
53+
```
54+
$ docker run --publish=8000:8000 --volume=$(pwd):/sketches --rm turicas/pyp5js
55+
```
56+
57+
This will run a container with `pyp5js serve` HTTP server listening on port
58+
8000 and serving the current directories' sketches. Now go to
59+
[http://localhost:8000](http://localhost:8000) and enjoy! :)
60+
61+
62+
#### Build/tag/publish the image
63+
64+
There are make targets to build, tag, publish and also run the image created
65+
locally:
66+
67+
- `make docker-build`: build a new image
68+
- `make docker-tag`: tag the built image using first 8 chars from commit SHA1
69+
- `make docker-push`: push to [Docker Hub](https://hub.docker.io/)
70+
- `make docker-serve`: run `pyp5js serve` using the local image
71+
- `make docker-sh`: run `bash` using the local image
72+
73+
> Note: the `docker-tag` and `docker-push` targets will use `$USER` as the
74+
> [Docker Hub](https://hub.docker.io/) username. If your system user is not the
75+
> same as Hub's username you can override the variable `DOCKERHUB_USER`, like
76+
> in: `make docker-tag DOCKERHUB_USER=xpto`.
77+
78+
4479
## Quickstart
4580

4681
Since you'll be writting Python code and then generating the correspondent

0 commit comments

Comments
 (0)