forked from evennia/evennia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
83 lines (71 loc) · 3.09 KB
/
Dockerfile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#####
# Base docker image for running Evennia-based games in a container.
#
# Install:
# install `docker` (https://docker.com)
#
# Usage:
# cd to a folder where you want your game data to be (or where it already is).
#
# docker run -it --rm -p 4000:4000 -p 4001:4001 -p 4002:4002 -v $PWD:/usr/src/game evennia/evennia
#
# (If your OS does not support $PWD, replace it with the full path to your current
# folder).
#
# You will end up in a shell where the `evennia` command is available. From here you
# can initialize and/or run the game normally. Use Ctrl-D to exit the evennia docker container.
# For more info see: https://github.com/evennia/evennia/wiki/Getting-Started#quick-start
#
# You can also start evennia directly by passing arguments to the folder:
#
# docker run -it --rm -p 4000:4000 -p 4001:4001 -p 4002:4002 -v $PWD:/usr/src/game evennia/evennia evennia start -l
#
# This will start Evennia running as the core process of the container. Note that you *must* use -l
# or one of the foreground modes (like evennia ipstart), since otherwise the container will immediately
# die because of having no foreground process.
#
# The evennia/evennia base image is found on DockerHub and can also be used
# as a base for creating your own custom containerized Evennia game. For more
# info, see https://evennia.com/docs/latest/Setup/Installation-Docker
#
FROM python:3.11-alpine
LABEL maintainer="https://www.evennia.com"
# install compilation environment
RUN apk update && apk add --no-cache bash gcc jpeg-dev musl-dev procps \
libffi-dev openssl-dev zlib-dev gettext \
g++ gfortran python3-dev cmake openblas-dev
# add the files required for pip installation
COPY ./pyproject.toml /usr/src/evennia/
COPY ./setup.py /usr/src/evennia/
COPY ./bin /usr/src/evennia/bin/
# install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir cryptography pyasn1 service_identity && \
pip install --no-cache-dir -e /usr/src/evennia --trusted-host pypi.python.org && \
pip install --no-cache-dir evennia[extra]
# add the project source; this should always be done after all
# expensive operations have completed to avoid prematurely
# invalidating the build cache.
COPY . /usr/src/evennia
# add the game source when rebuilding a new docker image from inside
# a game dir
ONBUILD COPY . /usr/src/game
# make the game source hierarchy persistent with a named volume.
# mount on-disk game location here when using the container
# to just get an evennia environment.
VOLUME /usr/src/game
# set the working directory
WORKDIR /usr/src/game
# set bash prompt and pythonpath to evennia lib
ENV PS1 "evennia|docker \w $ "
ENV PYTHONPATH /usr/src/evennia
# create and switch to a non-root user for runtime security
# -D - do not set a password
# -H - do not create a home directory
# -s /bin/false - set login shell to /bin/false
# RUN adduser -D -H -s /bin/false evennia
# USER evennia
# startup a shell when we start the container
ENTRYPOINT ["/usr/src/evennia/bin/unix/evennia-docker-start.sh"]
# expose the telnet, webserver and websocket client ports
EXPOSE 4000 4001 4002