Further dockerification

This commit is contained in:
Neale Pickett 2017-09-11 15:42:55 +00:00
parent 6a00d30c84
commit 9510f48253
8 changed files with 6383 additions and 4144 deletions

8
Dockerfile.moth-dev Normal file
View File

@ -0,0 +1,8 @@
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"]

View File

@ -0,0 +1,8 @@
FROM python:3
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"]

View File

@ -1,3 +1,17 @@
Being in this list is voluntary. Add your name when you contribute code.
Neale Pickett Neale Pickett
Patrick Avery Patrick Avery
Paul Ferrell
Shannon Steinfadt Shannon Steinfadt
Word List
---------
`answer_words.txt` was obtained thus:
url https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt | grep ...... > answer_words.txt
That repository says:
> This repo contains a list of the 10,000 most common English words in order of frequency, as determined by n-gram frequency analysis of the Google's Trillion Word Corpus.

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
FROM alpine
ENV base /srv/moth/default
ENV user ftp
# Get all packages
RUN apk --no-cache add git build-base
RUN apk --no-cache add lua5.3
RUN apk --no-cache add s6-networking
# Get source code
WORKDIR /usr/local/src
RUN git clone --branch master https://github.com/dirtbags/moth
RUN git clone https://github.com/nealey/eris
# Set up moth
WORKDIR /usr/local/src/moth
RUN mkdir -p $base
RUN cp tools/mothd /srv/moth
RUN cp -r www $base/www
RUN cp -r bin $base/bin
RUN mkdir $base/packages
RUN hd </dev/urandom | awk '{print $3 $4 $5 $6;}' | head -n 100 > $base/assigned.txt
RUN ln -s ../state/points.json $base/www/points.json
RUN ln -s ../state/puzzles.json $base/www/puzzles.json
RUN mkdir $base/state
RUN mkdir $base/state/teams
RUN touch $base/state/points.log
RUN mkdir -p $base/state/points.new
RUN mkdir -p $base/state/points.tmp
RUN chown -R $user $base/state
RUN ln -s lua5.3 /usr/bin/lua
# Set up eris
WORKDIR /usr/local/src/eris
RUN make
RUN cp eris /usr/local/bin
# Now, go
WORKDIR /
COPY run-moth /usr/local/bin
EXPOSE 80
CMD /usr/local/bin/run-moth $user

View File

@ -153,8 +153,8 @@ def build_category(categorydir, outdir):
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Build a category package') parser = argparse.ArgumentParser(description='Build a category package')
parser.add_argument('categorydirs', nargs='+', help='Directory of category source')
parser.add_argument('outdir', help='Output directory') parser.add_argument('outdir', help='Output directory')
parser.add_argument('categorydirs', nargs='+', help='Directory of category source')
args = parser.parse_args() args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View File

@ -1,10 +0,0 @@
#! /bin/sh
user=$1
uid=$(id -u $user)
su -s /srv/moth/mothd $user &
cd /srv/moth/default/www
exec s6-tcpserver -u $uid 0.0.0.0 80 /usr/local/bin/eris -. -c