Last active
November 24, 2019 22:09
-
-
Save samunders-core/089b081707576c2692ce6c52a411aea2 to your computer and use it in GitHub Desktop.
Alpine linux-based openra dedicated server container (~ 315MB)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wget -O - https://gist.github.com/samunders-core/089b081707576c2692ce6c52a411aea2/raw/ |\ | |
# sed -re '/(FROM|MAINTAINER|RUN)/d' -e 's|ENV|export|' -e '$a su -s /bin/sh ${U}' -e '/^EXPOSE/,$d' | /bin/sh | |
# | |
# # execute following as ${U}: | |
# sed -re '1{s|$|\npgrep -f "mono.*OpenRA.Server.exe.*Mod=" \&\& exit 0\ncd '"${B}"'\nexec\\|;p} 1,/while true; do/d; /done/,$d' ${B}/launch-dedicated.sh > ${H}/${U}.sh\ | |
# chmod +x ${H}/${U}.sh && echo "* * * * * ${H}/${U}.sh" | crontab - && exit | |
FROM alpine:latest | |
MAINTAINER sam_ | |
ENV V=release-20171014 | |
ENV U=openra | |
ENV H=/home/${U} | |
ENV B=${H}/OpenRA-${V} | |
RUN \ | |
adduser -h ${H} -s /sbin/nologin -D ${U} && \ | |
mkdir -p ${H}/.openra/Logs && \ | |
mkdir ${H}/.openra/maps | |
RUN \ | |
echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \ | |
apk update && \ | |
apk add mono libgdiplus build-base curl lua && \ | |
curl -L https://github.com/OpenRA/OpenRA/archive/${V}.tar.gz | tar xzf - -C ${H} && \ | |
ln -s /usr/lib/liblua.so.5.1.* /usr/lib/liblua.so.5.1 && \ | |
cd ${B} && make version VERSION=${V} && make && \ | |
apk del build-base curl && \ | |
chown -R ${U}:${U} ${H} | |
ENV Name="Dedicated Server" | |
ENV Mod=cnc | |
ENV ListenPort=1234 | |
ENV AdvertiseOnline=False | |
ENV Password= | |
EXPOSE ${ListenPort} | |
VOLUME [ "${H}/.openra/Logs", "${H}/.openra/maps" ] | |
USER ${U} | |
WORKDIR ${B} | |
ENTRYPOINT exec \ | |
/usr/bin/mono --debug OpenRA.Server.exe Game.Mod=${Mod} Server.Name="${Name}" \ | |
Server.ListenPort=${ListenPort} Server.ExternalPort=${ListenPort} \ | |
Server.AdvertiseOnline=${AdvertiseOnline} \ | |
Server.EnableSingleplayer=False Server.Password=${Password} | |
#ENTRYPOINT exec ${B}/launch-dedicated.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make your server available on https port (443) to "punch-through" corporate firewalls: