diff --git a/Dockerfile.moth b/Dockerfile.moth index 84330fa..23a16da 100644 --- a/Dockerfile.moth +++ b/Dockerfile.moth @@ -1,4 +1,4 @@ -FROM alpine AS builder +FROM alpine:3.8 AS builder RUN apk --no-cache add go libc-dev COPY src /src RUN go build -o /mothd /src/*.go diff --git a/Dockerfile.moth-devel b/Dockerfile.moth-devel index f6364e2..e82aecf 100644 --- a/Dockerfile.moth-devel +++ b/Dockerfile.moth-devel @@ -1,4 +1,4 @@ -FROM alpine:3.7 +FROM alpine:3.8 RUN apk --no-cache add \ gcc \ diff --git a/devel/mothballer.py b/devel/mothballer.py index f0799b1..0dde01d 100755 --- a/devel/mothballer.py +++ b/devel/mothballer.py @@ -37,60 +37,6 @@ def escape(s): return s.replace('&', '&').replace('<', '<').replace('>', '>') -def generate_html(ziphandle, puzzle, puzzledir, category, points, authors, files): - html_content = io.StringIO() - file_content = io.StringIO() - if files: - file_content.write( -'''
-

Associated files:

- -
-''') - scripts = [''.format(s) for s in puzzle.scripts] - - html_content.write( -''' - - - - - {category} {points} - - {scripts} - - -

{category} for {points} points

-
-{body}
-{file_content}
-
- - -
Team hash:
-
Answer:
- -
-
-
Puzzle by {authors}
- -'''.format( - category=category, - points=points, - body=puzzle.html_body(), - file_content=file_content.getvalue(), - authors=', '.join(authors), - scripts='\n'.join(scripts), - ) - ) - ziphandle.writestr(os.path.join(puzzledir, 'index.html'), html_content.getvalue()) - - def build_category(categorydir, outdir): category_seed = binascii.b2a_hex(os.urandom(20)) @@ -148,11 +94,11 @@ def package(categoryname, categorydir, seed): 'authors': puzzle.authors, 'hashes': puzzle.hashes(), 'files': files, + 'scripts': puzzle.scripts, 'body': puzzle.html_body(), } puzzlejson = json.dumps(puzzledict) zf.writestr(os.path.join(puzzledir, 'puzzle.json'), puzzlejson) - generate_html(zf, puzzle, puzzledir, categoryname, puzzle.points, puzzle.get_authors(), files) write_kv_pairs(zf, 'map.txt', mapping) write_kv_pairs(zf, 'answers.txt', answers)