diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/Dockerfile.moth-dev b/Dockerfile.moth-dev deleted file mode 100644 index 514f6d7..0000000 --- a/Dockerfile.moth-dev +++ /dev/null @@ -1,8 +0,0 @@ -FROM python:3 - -COPY tools/devel-server.py /pp/ -COPY tools/moth.py /pp/ -COPY tools/mistune.py /pp/ -COPY tools/answer_words.txt /pp/ - -ENTRYPOINT ["python3", "/pp/devel-server.py"] diff --git a/Dockerfile.moth-devel b/Dockerfile.moth-devel new file mode 100644 index 0000000..d0960c0 --- /dev/null +++ b/Dockerfile.moth-devel @@ -0,0 +1,12 @@ +FROM python:3-alpine + +COPY tools/devel-server.py /moth/ +COPY tools/moth.py /moth/ +COPY tools/mistune.py /moth/ +COPY tools/answer_words.txt /moth/ +COPY www /moth/src/www +COPY example-puzzles /moth/puzzles +COPY docs /moth/docs + +WORKDIR /moth/ +ENTRYPOINT ["python3", "/moth/devel-server.py"] diff --git a/Dockerfile.package-puzzles b/Dockerfile.package-puzzles index 1a61015..2d0bb2e 100644 --- a/Dockerfile.package-puzzles +++ b/Dockerfile.package-puzzles @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3-alpine COPY tools/package-puzzles.py /pp/ COPY tools/moth.py /pp/ diff --git a/docs/devel-server.md b/docs/devel-server.md index 9393b33..8e10275 100644 --- a/docs/devel-server.md +++ b/docs/devel-server.md @@ -9,38 +9,54 @@ It even works in Windows, because that is what my career has become. -Starting It Up ------------------ +Getting It Going +---------------- -Just run `devel-server.py` in the top-level MOTH directory. +### With Docker + +If you can use docker, you are in luck: + + docker run --rm -t -p 8080:8080 dirtbags/moth-devel + +Gets you a development puzzle server running on port 8080, +with the sample puzzle directory set up. + + +### Without Docker + +If you can't use docker, +try this: + + apt install python3 + git clone https://github.com/dirtbags/moth/ + cd moth + ./devel-server.py --puzzles example-puzzles Installing New Puzzles ----------------------------- -You are meant to have your puzzles checked out into a `puzzles` -directory off the main MOTH directory. -You can do most of your development on this living copy. - -In the directory containing `devel-server.py`, you would run something like: - - git clone /path/to/my/puzzles-repository puzzles - -or on Unix: - - ln -s /path/to/my/puzzles-repository puzzles - The development server wants to see category directories under `puzzles`, like this: - $ find puzzles -type d - puzzles/ - puzzles/category1/ - puzzles/category1/10/ - puzzles/category1/20/ - puzzles/category1/30/ - puzzles/category2/ - puzzles/category2/100/ - puzzles/category2/200/ - puzzles/category2/300/ + $ find puzzles -type d + puzzles/ + puzzles/category1/ + puzzles/category1/10/ + puzzles/category1/20/ + puzzles/category1/30/ + puzzles/category2/ + puzzles/category2/100/ + puzzles/category2/200/ + puzzles/category2/300/ + +### With Docker + + docker run --rm -t -v /path/to/my/puzzles:/moth/puzzles:ro -p 8080:8080 dirtbags/moth-devel + + +### Without Docker + +You can use the `--puzzles` argument to `devel-server.py` +to specify a path to your puzzles directory. diff --git a/tools/devel-server.py b/tools/devel-server.py index bf80ac3..c79a65b 100755 --- a/tools/devel-server.py +++ b/tools/devel-server.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#o/usr/bin/env python3 # To pick up any changes to this file without restarting anything: # while true; do ./tools/devel-server.py --once; done @@ -36,7 +36,7 @@ def page(title, body):