Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

tip2663/devvit-godot-build-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Minimal Godot 2D Web Build Pipeline (Devvit-Friendly)

Example

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.


🚀 TL;DR

  1. Make sure Docker is installed.
  2. Move your Godot project into the game/ subdirectory.
  3. Run:
./build.sh

You’ll get a Devvit-compatible export in ./export/web.

Now embed the exported project to the webroot of your Devvit Web View.


📦 What This Project Does

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.


🔧 Breakdown of Components

build.sh

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)
  • Removes the container after export.

custom.py

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" and opengl3 = "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.

Dockerfile

This builds the actual export environment.

Key steps:

  • Uses the barichello/godot-ci base 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.

html_shell/

Contains:

  • shell.html: a modified Godot export template that replaces inline values with data-* attributes.
  • shell.css and shell.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.


⚠️ Warnings / Limitations

  • 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.

🛠️ Contributing & Scope of Support

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.

🤝 Questions or Help?

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.

About

The pipeline i use to build reddit apps using devvit and godot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors