Skip to content

Commit 1beda99

Browse files
committed
Add yarn wrapper with Docker
1 parent 46e1bc0 commit 1beda99

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

scripts/docker-yarn-start.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
port="${1:-30000}"
5+
dys_inside='inside the container'
6+
mnt_dir='/mnt'
7+
8+
me="$(readlink -f "$0")"
9+
root_dir="$(dirname "$(dirname "$me")")"
10+
11+
case "$port" in
12+
(-h|--help)
13+
printf '%s [-h|--help] [<local-port>]\n' "$0"
14+
;;
15+
16+
("$dys_inside")
17+
cd "$root_dir/website"
18+
yarn
19+
yarn start
20+
;;
21+
22+
(*)
23+
cat >&2 <<END
24+
25+
*** browse http://127.0.0.1:$port/ *** CTRL-C to exit ***
26+
27+
END
28+
docker run --rm -it -v "$root_dir:$mnt_dir" -p "$port:3000" \
29+
node:alpine /bin/sh "$mnt_dir${me#$root_dir}" "$dys_inside"
30+
;;
31+
esac
32+
33+
exit 0

templates/contributing.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
## Contributing
22

3-
> Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms.
3+
> Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms.
4+
5+
6+
To test your contributions locally, if you have [Docker][] installed you can run `./scripts/docker-yarn-start.sh` which will run `yarn` and serve pages locally (by default on port `30000`).
7+
8+
[Docker]: https://www.docker.com/

0 commit comments

Comments
 (0)