-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (37 loc) · 1.39 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (37 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM alpine:latest AS builder
RUN apk add --no-cache \
build-base \
ncurses-dev \
flex \
bison \
wget \
tar \
linux-headers
WORKDIR /tmp
RUN wget https://github.com/NetHack/NetHack/archive/refs/tags/NetHack-3.6.7_Released.tar.gz \
&& tar -xzf NetHack-3.6.7_Released.tar.gz
WORKDIR /tmp/NetHack-NetHack-3.6.7_Released
RUN cd sys/unix \
&& sed -i 's/^PREFIX=.*/PREFIX=\/usr/' hints/linux-minimal \
&& sh setup.sh hints/linux-minimal \
&& cd ../.. \
&& make \
&& make install
FROM alpine:latest
RUN apk add --no-cache ncurses tmux \
&& adduser -s /bin/sh -D nethack
COPY --from=builder /usr/games /usr/games
ENV TERM=linux
ENV COLUMNS=80
ENV LINES=24
RUN chown -R nethack:nethack /usr/games/lib/nethackdir \
&& chmod 755 /usr/games/lib/nethackdir \
&& chmod 666 /usr/games/lib/nethackdir/record /usr/games/lib/nethackdir/perm \
&& chmod 666 /usr/games/lib/nethackdir/logfile /usr/games/lib/nethackdir/xlogfile \
&& echo "# NetHack 3.6.7 System Configuration File" > /usr/games/lib/nethackdir/sysconf \
&& echo "WIZARDS=*" >> /usr/games/lib/nethackdir/sysconf \
&& echo "EXPLORERS=*" >> /usr/games/lib/nethackdir/sysconf \
&& chown nethack:nethack /usr/games/lib/nethackdir/sysconf
WORKDIR /usr/games/lib/nethackdir
USER nethack
CMD ["sh", "-c", "tmux new-session -d -s nethack /usr/games/nethack && tmux attach-session -t nethack"]