Docker image with Godot and the macOS export templates
816
Godot with its macOS export templates, for exporting ad-hoc signed macOS .app bundles of Godot games and packing them into .dmg images.
Docker Hub · Source · All images
| Base image | debian:13.7 |
| Software | Godot 4.7.2 (official build) with export templates |
| Also included | makedmg (.dmg disk images), xorriso, ShellCheck |
| User | godot (uid 1000) with passwordless sudo (sudo apt-get install ...) |
| Tags | latest, 4.7.2, 4.7.2-YYYYMMDD |
Run in an empty directory; the commands work on the files of the current directory, mounted as the home directory of the container. CI runs these commands to check that they work.
# the Godot version and its export templates
docker run --rm aljazmc/godot-buildformac "godot --headless --version && ls \$XDG_DATA_HOME/godot/export_templates/*"
# export the project with its macOS preset: an ad-hoc signed Hello.app in a zip
docker run --rm -v .:/home/godot -w /home/godot aljazmc/godot-buildformac "godot --headless --import && mkdir -p build/macos && godot --headless --export-release macOS build/macos/hello.zip"
# unpack it and make build/hello.dmg
docker run --rm -v .:/home/godot -w /home/godot aljazmc/godot-buildformac "unzip -oq build/macos/hello.zip -d build/macos && makedmg build/macos/Hello.app build/hello.dmg"
## docker-compose.yml example
services:
godot:
image: aljazmc/godot-buildformac
working_dir: /home/godot
user: godot
volumes:
- .:/home/godot
## run commands in the container:
docker compose run --rm godot "godot --headless --import && mkdir -p build/macos && godot --headless --export-release macOS build/macos/hello.zip"
The commands expect a Godot 4 project in the current directory with an export_presets.cfg that has a macOS preset, like this one. A universal build, for Intel and Apple silicon Macs, also needs textures/vram_compression/import_etc2_astc=true in the [rendering] section of project.godot. Godot doesn't create the output directory, so the commands do.
[preset.0]
name="macOS"
platform="macOS"
runnable=true
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/macos/hello.zip"
[preset.0.options]
binary_format/architecture="universal"
application/bundle_identifier="com.example.hello"
codesign/codesign=1
notarization/notarization=0
## export the game:
docker compose run --rm godot "godot --headless --import && mkdir -p build/macos && godot --headless --export-release macOS build/macos/hello.zip"
The result is the build/macos/hello.zip archive with Hello.app inside. Extract it on a Mac and open Hello.app.
textures/vram_compression/import_etc2_astc=true in project.godot, otherwise the export fails with a configuration error. The generated project already has it. Add it to your own projects too.application/bundle_identifier is required. Change com.example.hello to your own identifier.codesign/codesign=1 signs the app ad-hoc with Godot's built-in signer. Without a signature the app doesn't start on Apple Silicon.xattr -dr com.apple.quarantine Hello.app.--import imports the project's resources first. It is only needed when resources were added or changed outside of the editor.build/.gdignore keeps Godot from importing the exported files.Applications for macOS are .app bundles and they are usually distributed in a .dmg disk image. Opening the .dmg shows the app next to a link to the Applications folder, and the app is installed by dragging it there. makedmg creates such an image with xorriso (installed in the image).
## the image contains this script as the `makedmg` command ([source](https://github.com/aljazmc/dockerfiles/blob/main/godot/buildformac/makedmg)):
#!/bin/bash
set -e
APP="${1:?usage: makedmg <app bundle> <output.dmg>}"
OUT="${2:?usage: makedmg <app bundle> <output.dmg>}"
NAME="$(basename "$APP" .app)"
STAGE="$(mktemp -d)"
chmod 755 "$STAGE"
cp -a "$APP" "$STAGE"/
ln -s /Applications "$STAGE/Applications"
rm -f "$OUT"
xorriso -as mkisofs -quiet -V "$NAME" -hfsplus -R -o "$OUT" "$STAGE"
rm -rf "$STAGE"
## create the disk image:
docker compose run --rm godot "godot --headless --import && mkdir -p build/macos && godot --headless --export-release macOS build/macos/hello.zip && unzip -oq build/macos/hello.zip -d build/macos && makedmg build/macos/Hello.app build/hello.dmg"
The result is build/hello.dmg. Open it on a Mac and drag Hello.app to Applications.
makedmg <app bundle> <output.dmg>..dmg. Compressed .dmg images (UDZO) can only be created with hdiutil on macOS..dmg files with the quarantine flag and macOS passes it on to the app, so the notes about Gatekeeper above apply to the app copied from the .dmg too..dmg directly only on macOS, on other systems it exports a .zip. The commands above extract the .app from the .zip first..app bundle.latest: the newest build.4.7.2: the Godot version in the image, e.g. aljazmc/godot-buildformac:4.7.2. Use it to stay on a known version.4.7.2-YYYYMMDD: the same version, built on that date (UTC), e.g. 4.7.2-20261122. Every build gets its own tag that never moves, so use it where you need exactly the same image again.GODOT_VERSION in the Dockerfile.The Dockerfile, the scripts and this README are part of aljazmc/dockerfiles, released under the MIT License.
The software in the image keeps its own license:
| Software | License | In the image |
|---|---|---|
| Godot Engine | MIT | godot --headless --version, godotengine.org/license |
Every other package keeps its license too: apk info --license <package> shows it on Alpine, /usr/share/doc/<package>/copyright on Debian.
Content type
Image
Digest
sha256:16e4c5ce6…
Size
389.3 MB
Last updated
1 day ago
docker pull aljazmc/godot-buildformac