evennia/Dockerfile
Aris (Karim) Merchant cb96f6892f Change Dockerfile to comply with best practices
In order of decreasing significance:
* Move addition of all files later to avoid premature build cache
  invalidation
* Add separate instructions to copy over files needed earlier
* Change deprecated MAINTAINER instruction to LABEL maintainer
* Change ADD to COPY, as ADD apparently behaves weirdly in some cases
* Alphabetize dependencies for readability
2018-07-31 13:11:32 -07:00

64 lines
2.1 KiB
Docker

#####
# Base docker image for running Evennia-based games in a container.
#
# Install:
# install `docker` (http://docker.com)
#
# Usage:
# cd to a folder where you want your game data to be (or where it already is).
#
# docker run -it -p 4000:4000 -p 4001:4001 -p 4005:4005 -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 install and run the game normally. Use Ctrl-D to exit the evennia docker container.
#
# 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://github.com/evennia/evennia/wiki/Running%20Evennia%20in%20Docker .
#
FROM alpine
LABEL maintainer="www.evennia.com"
# install compilation environment
RUN apk update && apk add bash gcc jpeg-dev musl-dev procps py-pip \
py-setuptools py2-openssl python python-dev zlib-dev
# add the files required for pip installation
COPY ./setup.py /usr/src/evennia/
COPY ./requirements.txt /usr/src/evennia/
COPY ./evennia/VERSION.txt /usr/src/evennia/evennia/
COPY ./bin /usr/src/evennia/bin/
# install dependencies
RUN pip install -e /usr/src/evennia --trusted-host pypi.python.org
RUN pip install cryptography pyasn1 service_identity
# 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
ENV PS1 "evennia|docker \w $ "
# startup a shell when we start the container
ENTRYPOINT ["bash"]
# expose the telnet, webserver and websocket client ports
EXPOSE 4000 4001 4005