You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.9 KiB
89 lines
2.9 KiB
FROM debian:buster as build
|
|
|
|
ARG nethack_version=3.6.7
|
|
|
|
RUN apt-get update -y
|
|
|
|
RUN apt-get install -y gcc make flex bison build-essential git libncurses5-dev wget autotools-dev autoconf sqlite3 libsqlite3-dev
|
|
|
|
# Build dgamelaunch
|
|
WORKDIR /
|
|
|
|
RUN git clone https://github.com/paxed/dgamelaunch.git
|
|
|
|
WORKDIR dgamelaunch
|
|
|
|
RUN ./autogen.sh --enable-sqlite --enable-shmem --with-config-file=/opt/nethack/nethack.jerryaldrichiii.com/etc/dgamelaunch.conf
|
|
|
|
RUN make
|
|
|
|
COPY dgl-create-chroot.sh dgl-create-chroot.sh
|
|
RUN sh dgl-create-chroot.sh
|
|
|
|
WORKDIR /opt/nethack/nethack.jerryaldrichiii.com/
|
|
|
|
# Copy libs needed at runtime
|
|
RUN cp /lib/x86_64-linux-gnu/libncurses.so.6 lib/x86_64-linux-gnu/
|
|
RUN cp /lib/x86_64-linux-gnu/libnss_files.so.2 lib/x86_64-linux-gnu/libnss_files.so.2
|
|
|
|
COPY dgamelaunch.conf etc/dgamelaunch.conf
|
|
|
|
# Build Nethack
|
|
WORKDIR /
|
|
RUN wget https://github.com/NetHack/NetHack/archive/NetHack-${nethack_version}_Released.tar.gz
|
|
|
|
RUN tar xvzf NetHack*.tar.gz
|
|
|
|
WORKDIR NetHack-NetHack-${nethack_version}_Released
|
|
|
|
COPY ./hints.sh hints.sh
|
|
|
|
RUN sh sys/unix/setup.sh hints.sh
|
|
|
|
RUN make && make install
|
|
|
|
# TODO: Add a custom sysconf? https://nethackwiki.com/wiki/Sysconf
|
|
RUN cp -R /root/nethack/chroot/nethack/* /opt/nethack/nethack.jerryaldrichiii.com/nethack
|
|
# TODO: No nethack user exists here, use chgrp
|
|
RUN chown games:games /opt/nethack/nethack.jerryaldrichiii.com/nethack/sysconf
|
|
|
|
# Could probably use alpine..but I'm too lazy to trackdown libc/musl errors
|
|
FROM debian:stable-slim
|
|
|
|
LABEL maintainer "jerryaldrichiii@gmail.com"
|
|
|
|
RUN apt-get update && apt-get install -y openssh-server && apt-get clean
|
|
|
|
COPY --from=build /opt/nethack/nethack.jerryaldrichiii.com/ /opt/nethack/nethack.jerryaldrichiii.com
|
|
RUN cp -R /opt/nethack/nethack.jerryaldrichiii.com/dgldir /opt/nethack/nethack.jerryaldrichiii.com/dgldir.orig
|
|
RUN cp -R /opt/nethack/nethack.jerryaldrichiii.com/nethack/var /opt/nethack/nethack.jerryaldrichiii.com/nethack_var.orig
|
|
RUN cp /opt/nethack/nethack.jerryaldrichiii.com/usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu/
|
|
COPY dgl_menu_main_user.txt /opt/nethack/nethack.jerryaldrichiii.com/
|
|
|
|
RUN useradd --no-create-home --gid 60 --shell /opt/nethack/nethack.jerryaldrichiii.com/dgamelaunch nethack
|
|
RUN passwd -d nethack
|
|
|
|
RUN chown -R nethack:games /opt/nethack/nethack.jerryaldrichiii.com/nethack
|
|
|
|
# If you figure out how to make this run without suid or root...let me know
|
|
RUN chmod 4755 /opt/nethack/nethack.jerryaldrichiii.com/dgamelaunch
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Configure SSHD
|
|
RUN mkdir -p /srv/sshd/host_keys
|
|
COPY sshd_config /srv/sshd/sshd_config
|
|
RUN chown -R nethack /srv/sshd
|
|
RUN cp /etc/passwd /opt/nethack/nethack.jerryaldrichiii.com/etc
|
|
RUN chown nethack /etc/shadow
|
|
|
|
EXPOSE 2323
|
|
|
|
VOLUME ["/opt/nethack/nethack.jerryaldrichiii.com/dgldir"]
|
|
VOLUME ["/opt/nethack/nethack.jerryaldrichiii.com/nethack/var"]
|
|
VOLUME ["/srv/sshd/host_keys"]
|
|
|
|
USER nethack
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|