ARCHIVED Starting with Godot 4.5.1 it became much easier to optimize the web export configurations. Please see the official godot docs on compiling for the web
This is a stripped-down, Dockerized pipeline I use to export Godot 2D HTML5 games for Devvit Reddit-App deployment. It’s minimal, CSP-compliant, and easy to tweak. Mostly shared as a proof of concept or starting point—maintain it yourself if you build on it.
- Make sure Docker is installed.
- Move your Godot project into the
game/subdirectory. - Run:
./build.shYou’ll get a Devvit-compatible export in ./export/web.
Now embed the exported project to the webroot of your Devvit Web View.
This setup builds a Godot export template and your game in one shot inside Docker. It's tuned specifically for:
- Minimal file size
- No 3D or extra modules
- Full CSP compliance (no inline JS/styles)
- Encrypted export support
The result is a clean HTML5 export you can safely embed in Devvit posts or other platforms with strict content security policies.
This is the build script. It:
-
Builds a Docker image with the Godot source, Emscripten, and your game.
-
Creates a one-off container from it.
-
Extracts:
- The export (
./export/web) - The generated encryption credentials (
./export/creds.cfg)
- The export (
-
Removes the container after export.
This file controls how Godot is compiled. It disables everything except what's absolutely needed for a 2D OpenGL-based web game.
Highlights:
disable_3d = "yes"optimize = "size"vulkan = "no"andopengl3 = "yes"- All unneeded modules are set to
"no"to reduce size and complexity.
Edit this to suit your needs—enable 3d, media formats, etc., if required.
This builds the actual export environment.
Key steps:
- Uses the
barichello/godot-cibase to have a precompiled godot instance. - Installs Emscripten to compile Godot for web.
- Clones and compiles Godot with your stripped-down
custom.py. - Generates an AES-256 encryption key for export protection.
- Builds your game's web release inside Docker using
godot --headless. - Replaces the standard Godot HTML export shell with a custom, CSP-compliant version.
Contains:
shell.html: a modified Godot export template that replaces inline values withdata-*attributes.shell.cssandshell.js: external files that load splash, config, and start the engine.
Devvit doesn’t allow inline <script> or <style>, so we move everything out-of-line.
- The build overwrites your
game/export_presets.cfg, so if you edit presets in the Godot editor, be sure to sync any changes manually. - I don’t publish the Docker image because each build generates a unique AES key. If you want to publish one, you should strip encryption.
- This is a minimal viable pipeline, not a production system. Use it as a base, not an end-all solution.
This repo is intended as a minimal, self-contained build pipeline. You're welcome to fork, modify, or contribute via pull requests—especially if you're improving the build process, optimizing size, or enhancing CSP compatibility.
However, I won't troubleshoot issues unrelated to the pipeline itself.
That means:
🚫 I won’t help debug your game logic, scenes, or why it crashes in the browser. 🚫 I won’t help you upload it to Devvit if it's too big, too slow, or violates Devvit’s constraints. 🚫 I won’t patch around Reddit quirks or handle “my post won't load” support tickets.
If you’re having trouble with Devvit hosting or your exported game’s behavior, I suggest isolating the issue in a clean Godot export and debugging from there.
Keep issues and PRs scoped to this pipeline only.
This is shared as-is for anyone who finds it useful. I'm happy to answer questions when I can—just ping me on Discord or Reddit if you’re stuck or curious.