diff --git a/Dockerfile b/Dockerfile index 6cfedc071e..0ca2a8dd74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,35 +24,49 @@ # or one of the foreground modes (like evennia ipstart), since otherwise the container will immediately # die because of having no foreground process. # +# Build modes: +# Default build mode is editable and installs local Evennia source as: +# pip install -e /usr/src/evennia[extra] +# This is convenient for development of both game code and Evennia core. +# +# To instead build from the latest Evennia release on PyPI: +# docker build --build-arg EVENNIA_INSTALL_MODE=pypi -t evennia/evennia . +# +# Editable mode development tip: +# Mount your Evennia checkout to /usr/src/evennia to edit the core live: +# docker run -it --rm -p 4000:4000 -p 4001:4001 -p 4002:4002 \ +# -v $PWD:/usr/src/game -v /path/to/evennia:/usr/src/evennia evennia/evennia +# # 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 +FROM python:3.13-alpine LABEL maintainer="https://www.evennia.com" +ARG EVENNIA_INSTALL_MODE=editable # 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 +# install dependencies/evennia +# EVENNIA_INSTALL_MODE options: +# - editable (default): install local source in editable mode for Evennia dev. +# - pypi: install latest Evennia release from PyPI. +RUN pip install --no-cache-dir --upgrade pip && \ + if [ "$EVENNIA_INSTALL_MODE" = "pypi" ]; then \ + pip install --no-cache-dir --upgrade evennia[extra]; \ + else \ + pip install --no-cache-dir -e /usr/src/evennia[extra]; \ + fi + # add the game source when rebuilding a new docker image from inside # a game dir ONBUILD COPY . /usr/src/game @@ -66,8 +80,8 @@ VOLUME /usr/src/game WORKDIR /usr/src/game # set bash prompt and pythonpath to evennia lib -ENV PS1 "evennia|docker \w $ " -ENV PYTHONPATH /usr/src/evennia +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