Skip to content

feat(docker): keep only the run-time files in the image - #1

Merged
malken21 merged 10 commits into
mainfrom
chore/slim-image
Nov 6, 2026
Merged

malken21 merged 10 commits into
mainfrom
chore/slim-image

Conversation

@malken21

@malken21 malken21 commented Nov 4, 2026

Copy link
Copy Markdown
Member

Shrinks the image: exports a .pck, runs it with the release template, and copies only the needed files onto scratch. The GPU path still needs a check on a machine with the iGPU before this replaces the running image.

Export the project to a .pck and run it with the release export template instead of the editor. Copy just the
programs, the libraries they load and their data onto scratch: no package manager, no editor, only the Intel
Vulkan driver. Default to a non-root user.

CI: build on pull requests, check that all libraries resolve and the scripts load from the .pck, report the size.
Publish from main only, pin actions by commit SHA and limit packages: write to the build job.
Release export templates are built without path overrides, so they drop
-s, --main-loop and the scene path from the command line (main.cpp clears
them when OVERRIDE_PATH_ENABLED is off). The image ran the template with
-s res://scripts/main.gd, so Godot started an empty SceneTree and never
exited: the renderer did nothing, and the CI check waited until the job
was cancelled.

main.gd now has a class name and project.godot names it in
application/run/main_loop_type, which the template honours. render.sh
and the CI check drop -s. Every container in the check gets a time limit.
The release template stops in setup with "no main scene defined" when the
command line names no scene, even if a main loop type is set. main.tscn is
an empty Node, so the template starts and RendererMain runs.
The pack stage copied only project.godot, export_presets.cfg, scripts and shaders, so the export had no main scene to load.
The runner has no GPU, so drawing is checked on the server. The image is saved as an artifact on pull requests only.
@malken21

malken21 commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

本番機の内蔵 GPU (Intel UHD 730) で、このプルリクエストのイメージ (CI の成果物、50b402f) を試した。

  • 描画: flat ワールドの 4 タイル (render --tiles -8,4,2,2 --persp iso_SE_30_hires)。今の toro-renderer:latest で描いたものを --ref にして比べ、画素の一致は 65536/65536 (100.00%)。PNG と WebP の 8 ファイルはバイト単位で同じ
  • 大きさ (展開後): 611 MB → 320 MB
  • 縛り: --network none、読み取り専用のルート、--cap-drop ALL、no-new-privileges、描画用のデバイスだけ

途中で見つけて直したこと:

  • 書き出し用テンプレートはパスの上書きを無効にして作られていて、-s、--main-loop、シーンのパスを捨てる。そのため -s res://scripts/main.gd で起動したテンプレートは空の SceneTree を動かし続け、終わらなかった (前の CI が 6 時間と 30 分で止まった原因)。main.gd にクラス名を付け、application/run/main_loop_type で入口にした
  • テンプレートは main scene が無いと起動しないので、空の main.tscn を足した
  • CI のすべてのコンテナに時間の上限を付けた。プルリクエストのイメージは 1 日だけ成果物として残る (GPU のある機械で試すため)

@malken21
malken21 merged commit ebaf6f1 into main Nov 6, 2026
1 check passed
@malken21
malken21 deleted the chore/slim-image branch November 7, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant