diff --git a/Dockerfile.mothd b/Dockerfile.moth similarity index 100% rename from Dockerfile.mothd rename to Dockerfile.moth diff --git a/Dockerfile.package-puzzles b/Dockerfile.package-puzzles deleted file mode 100644 index f9f152f..0000000 --- a/Dockerfile.package-puzzles +++ /dev/null @@ -1,10 +0,0 @@ -FROM alpine - -RUN apk --no-cache add python3 py3-pillow - -COPY tools/package-puzzles.py /pp/ -COPY tools/moth.py /pp/ -COPY tools/mistune.py /pp/ -COPY tools/answer_words.txt /pp/ - -ENTRYPOINT ["python3", "/pp/package-puzzles.py"] diff --git a/README.md b/README.md index 00f9d95..2d73d75 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Click the `[mb]` link by a puzzle category to compile and download a mothball th Running a Production Server =========================== - docker run --rm -it -p 8080:8080 -v /path/to/moth:/moth dirtbags/mothd + docker run --rm -it -p 8080:8080 -v /path/to/moth:/moth dirtbags/moth You can be more fine-grained about directories, if you like. Inside the container, you need the following paths: diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..583fc7c --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +version=$(date +%Y%m%d%H%M) + +for img in moth moth-devel; do + echo "==== $img" + docker build --build-arg http_proxy=$http_proxy --tag dirtbags/$img --tag dirtbags/$img:$version -f Dockerfile.$img . + [ "$1" = "--push" ] && docker push dirtbags/$img:$version && docker push dirtbags/$img +done diff --git a/install.sh b/install.sh deleted file mode 100755 index f9f9d91..0000000 --- a/install.sh +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/sh -e - -DESTDIR=$1 - -if [ -z "$DESTDIR" ]; then - echo "Usage: $0 DESTDIR" - exit -fi - -cd $(dirname $0) - -older () { - [ -z "$1" ] && return 1 - target=$1; shift - [ -f $target ] || return 0 - for i in "$@"; do - [ $i -nt $target ] && return 0 - done - return 1 -} - -copy () { - src=$1 - target=$2/$src - targetdir=$(dirname $target) - if older $target $src; then - echo "COPY $src" - mkdir -p $targetdir - cp $src $target - fi -} - -setup() { - [ -d $DESTDIR/state ] && return - echo "SETUP" - for i in points.new points.tmp teams; do - dir=$DESTDIR/state/$i - mkdir -p $dir - setfacl -m ${www}:rwx $dir - done - mkdir -p $DESTDIR/packages - >> $DESTDIR/state/points.log - if ! [ -f $DESTDIR/assigned.txt ]; then - hd $DESTDIR/assigned.txt - fi - - mkdir -p $DESTDIR/www - ln -sf ../state/points.json $DESTDIR/www - ln -sf ../state/puzzles.json $DESTDIR/www -} - - -echo "Figuring out web user..." -for www in www-data http tc _ _www; do - id $www && break -done -if [ $www = _ ]; then - echo "Unable to determine httpd user on this system. Dying." - exit 1 -fi - -mkdir -p $DESTDIR || exit 1 - -setup -git $SRCDIR ls-files | while read fn; do - case "$fn" in - example-puzzles/*|tools/*|docs/*|install.sh|setup.cfg|README.md|.gitignore|src/mothd) - true # skip - ;; - www/*) - copy $fn $DESTDIR/ - ;; - bin/*) - copy $fn $DESTDIR/ - ;; - *) - echo "??? $fn" - ;; - esac -done - -echo "All done installing."