Skip to content

old6ixx/renpy-in-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ren'Py in Docker

Features

  • Build distributions for Ren'Py projects
  • Launch projects through X11
  • Support multi architectures: amd64, arm64, arm
  • Run as non-root user by setting PUID and PGID, like linuxserver.io does

Usage

All examples below are based on Ren'Py 8.0.3.

Quickstart

To build a PC distribution for the official example game, The Question, you can run a single command:

docker run --rm -it -v ${PWD}/out:/out \
  old6ix/renpy:8.0.3 launcher distribute ./the_question --dest /out --package pc

Then you will get the distribution in out/ directory:

$ ls out/
the_question-7.0-pc.zip

Build distributions for your own game

Technically, you can bind your project to nearly any directory you want, but I'd like to choose /src.

docker run --rm -it \
  -v /path/to/renpy/project:/src \
  -v /path/to/output:/out \
  old6ix/renpy:8.0.3 launcher distribute /src --dest /out

You should get distributions for different platform in /path/to/output directory.

Launch a project

Most of the operations in this section are for configuring X11. Don't panic, it's easy even if you know little about it. Just follow the steps; If you're familiar with it, you can jump to the 3rd launching step.

1. Set a displaying screen

Note: If you prefer skipping this step, just open a terminal in your Linux desktop, which is likely to finish the setting automatically.

Set $DISPLAY env to choose which screen you want the GUI to be shown on. For example:

export DISPLAY=:0.0

will make your game be displayed on the 1st screen of the 1st display (might your only screen). If you want to get a brief introduction about $DISPLAY, I believe this discussion in Ask Ubuntu will help you a lot.

2. Grant permission to the running user

Use xhost to allow the running user to make connections to the X server. Since we were running renpy as root so far, let's still use root as an example. Running as non-root user will be discussed in next section.

xhost +local:root

This command will allow root user to display on screen $DISPLAY.

3. Launch

To run The Question as a demo, execute this command:

docker run --rm -it \
  -e DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  old6ix/renpy:8.0.3 ./the_question

This window will be displayed on the screen you've set in the first step:

Screenshot

Or your own game:

docker run --rm -it \
  -e DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v /path/to/renpy/project:/src \
  old6ix/renpy:8.0.3 /src

Apart from unix socket, you can also connect it to the X server by changing the container's network to host mode. This is all about X11, neither Ren'Py nor this image.

docker run --rm -it \
  --network host \
  -e DISPLAY \
  -v /path/to/renpy/project:/src \
  old6ix/renpy:8.0.3 /src

Run as non-root user

It's usually not wise to run a container under the root user domain. Therefore, environment variables PUID and PGID are supported to be used in this image to map the container's internal user to a user on the host machine, just like images from linuxserver.io.

The following command will make distributions as user 1000 in group 1001.

docker run --rm -it \
  -e PUID=1000 -e PGID=1001 \
  -v ${PWD}/out:/out \
  old6ix/renpy:8.0.3 launcher distribute ./the_question --dest /out

Note: Because of volume permissions in Docker, the output directory has to be created and is writable by the running user before executing this command, only except in rare cases.

Development

Build the image

export RENPY_VERSION=8.0.3  # expected version
docker build \
  -t old6ix/renpy:$RENPY_VERSION \
  --build-arg RENPY_VERSION=$RENPY_VERSION \
  .

About

Test, build, and even run your Ren'Py projects inside Docker. Support x86-64 and ARM arch.

Topics

Resources

License

Stars

Watchers

Forks