From 33ca5719e821213e56d7dcc2e92fb01d6f410b9f Mon Sep 17 00:00:00 2001 From: Cory Petkovsek <632766+tinmanjuggernaut@users.noreply.github.com> Date: Tue, 12 Nov 2019 16:37:59 +0800 Subject: [PATCH] update README --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4345c1d..89b4b60 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,102 @@ -# Godot engine build containers +# Godot Engine Build Containers This repository contains the Dockerfiles for the official Godot engine builds. These containers should help you build Godot for all platforms supported on any machine that can run Docker containers. -## Building -There is a 'build.sh' script included to build the containers themselves. The in-container build scripts will follow shortly. +## What is a Docker? + +A Docker is like a chroot environment with its own filesystem, network stack, and process tree. They are similar to a virtual machine, but they use the same kernel as the host operating system. + +Basically a **docker image** is a filesystem you can instantiate into a running **docker container**. This allows you to set up and run a complete environment with an isolated filesystem, network stack and process tree, without impacting your primary OS. Though the docker does use the same kernel as the host OS. + +After using these scripts, you will have several linux docker images, each designed to cross compile Godot for a particular platform with officially designated, compatible versions of compilers, sdks and libraries. + +[Read more about docker](https://docs.docker.com/engine/docker-overview/). + + +## How to use this repository + +You'll need 25GB to store the entire collection (using Podman/overlayfs; maybe 40GB+ for Podman/vfs - see #1) and another 10-20GB while building. The entire process will take 5-10+ hours of downloading and compiling depending on the speed of your internet and system. + +You can reduce both time and space by manually building only the dockers you need. (see #3) + +1. Install [podman](https://podman.io/getting-started/) or [docker](https://docs.docker.com/install/). + + **Note:** Podman has benefits over docker such as not requiring root access or running a daemon. However it will waste a lot of space if it is configured to use the vfs system. You can reduce space usage by using overlayfs. Do these steps before creating any containers or images. + + 1. Install `fuse-overlayfs`. + 1. Edit these lines under the named sections in `~/.config/containers/storage.conf`: + ``` + [storage] + driver = "overlay" + + [storage.options] + mount_program = "/usr/bin/fuse-overlayfs" + ``` + +1. Clone the repository: +`git clone https://github.com/godotengine/build-containers` + +1. Run `./build.sh `. e.g. `./build.sh 3.1 mono-5.18.1.3` + * As of November, 2019, the official binaries are being built with mono version 5.18.1.3. + * You can find Godot branches by clicking the Branch button on this page: https://github.com/godotengine/godot + * You can find Mono branches/tags under the Branch button here: https://github.com/mono/mono + * You could also manually step through the lines in this script in order to install only the dockers you're interested in, e.g. windows/mono. + +1. Once `build.sh` completes, check your images. You can usally replace the command `podman` with `docker` if you installed the latter. + ``` + $ podman images + REPOSITORY TAG IMAGE ID CREATED SIZE + localhost/godot-osx latest 934d65ff33fc 3 hours ago 2.18 GB + localhost/godot-ios latest 8115af962086 3 hours ago 2.03 GB + localhost/godot-xcode-packer latest 9075c85cffcd 3 hours ago 1.11 GB + localhost/godot-xcode-test latest 254991aa6a2a 3 hours ago 255 MB + localhost/godot-javascript latest 9bb17f594595 3 hours ago 1.34 GB + localhost/godot-android latest 8b894fa58db3 21 hours ago 12.8 GB + localhost/godot-ubuntu-64 latest 45ecfc4e4fa0 37 hours ago 1.11 GB + localhost/godot-ubuntu-32 latest fbc92a88f15a 38 hours ago 1.05 GB + localhost/godot-windows latest 1f3e021fa80b 38 hours ago 3.38 GB + localhost/godot-mono-glue latest c7702baefda2 38 hours ago 1.42 GB + localhost/godot-mono 5.18.1.3 7f9ceb195878 38 hours ago 1.18 GB + localhost/godot-export latest 3ce4d96d548f 39 hours ago 255 MB + localhost/godot-fedora latest fb8358105a5e 39 hours ago 255 MB + docker.io/library/fedora 30 89d6d6a7d521 2 weeks ago 255 MB + docker.io/i386/ubuntu trusty 822956e6c5eb 6 months ago 187 MB + docker.io/library/ubuntu trusty 2c5e00d77a67 6 months ago 197 MB + + ``` + +### Running a shell inside a docker container +This will instantiate a container based upon the specified image. Here `godot-windows` refers to the `localhost/godot-windows` image listed above. +``` +$ podman run -it --rm godot-windows /usr/bin/bash + +[root@a117e628763d ~]# +``` + +### Building Godot within a container +You can mount your Godot source tree (`/home/user/godot` below) inside a container, then compile from there: +``` +$ podman run -it --rm -v /home/user/godot:/root/godot godot-windows /bin/sh + +[root@a117e628763d ~]# cd godot + +[root@a117e628763d godot]# scons -j8 p=windows bits=64 tools=yes target=release_debug module_mono_enabled=yes mono_static=yes mono_glue=yes copy_mono_root=yes mono_prefix=/root/dependencies/mono-64 +``` + +Or you can run it all in one command: +`podman run --rm -v /home/user/godot:/root/godot godot-windows scons -C godot -j8 p=windows bits=64 tools=yes target=release_debug module_mono_enabled=yes mono_static=yes mono_glue=yes copy_mono_root=yes mono_prefix=/root/dependencies/mono-64` + + +### Transfering files +For any part of your host OS directory tree that you have mounted inside a container, you can simultaneously access it inside the docker shell or in your host OS. This allows you to mount the Godot source from your host OS, and as the docker builds Godot, all files are being written to the host OS filesystem. You can immediately access them, for instance to grab the executables from the `godot/bin` directory. + + +### Removing docker images +You can remove an image by specifying either the name, or if it was an incomplete build, the image id. Either of these will delete the android image listed above. +``` +$ podman rmi 8b894fa58db3 +or +$ podman rmi localhost/godot-android +```