mirror of https://github.com/dirtbags/moth.git
Dockerization, yay!
This commit is contained in:
parent
631d1d800c
commit
b8c1d9f4a8
|
@ -0,0 +1,44 @@
|
||||||
|
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
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#! /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
|
||||||
|
|
Loading…
Reference in New Issue