This docker image is designed to build, test and export your games on a CI/CD pipeline. It only contains the Godot engine with the tagged version.
To test the image locally you can run:
docker container run dunkelgrau/godot:4.2.2 godot --versionThe following minimal examples demonstrate how to setup a basic pipeline for different automation servers. The example imports all assets, export a windows build and archives the result.
The example assumes, that the Godot project file is on the root folder of your repository.
Add .github/workflows/godot-ci.yml to your repository with the following content:
name: Godot CI/CD
on:
push:
branches:
- main
env:
EXPORT_NAME: MyGodotGame
jobs:
export_windows:
runs-on: ubuntu-latest
container: dunkelgrau/godot:4.2.2
steps:
- name: Create symbolic link for export templates
run: ln -s /root/.local /github/home/.local
- name: Check out repository
uses: actions/checkout@v4
- name: Import Godot project
run: godot --headless --import
- name: Create build folder
run: mkdir -p build/windows
- name: Export Windows executable
run: godot --headless --export-release Windows\ Desktop build/windows/${EXPORT_NAME}.exe
- name: Archive Windows executable
uses: actions/upload-artifact@v4
with:
name: ${{ env.EXPORT_NAME }}
path: build/windows
if-no-files-found: errorAdd .gitlab-ci.yml to your repository with the following content:
image: dunkelgrau/godot:4.2.2
stages:
- export
variables:
EXPORT_NAME: MyGodotGame
export:
stage: export
only:
- main
script:
- godot --headless --import
- mkdir -p build/windows
- godot --headless --export-release Windows\ Desktop build/windows/${EXPORT_NAME}.exe
artifacts:
name: $EXPORT_NAME
paths:
- build/windowsAdd Jenkinsfile to your repository with the following content:
pipeline {
agent {
docker { image 'dunkelgrau/godot:4.2.2' }
}
environment {
EXPORT_NAME = 'MyGodotGame'
}
stages {
stage('Export Windows') {
steps {
sh 'godot --headless --import'
sh "mkdir -p build/windows"
sh "godot --headless --export-release Windows\ Desktop build/windows/${EXPORT_NAME}.exe"
sh "cd build/windows && zip -r ../../build/${EXPORT_NAME}.zip ./* && cd -"
archiveArtifacts artifacts: "build/${EXPORT_NAME}.zip"
}
}
}
}Use this docker image as base to deploy your game at itch.io. For example:
FROM dunkelgrau/godot:4.2.2
RUN wget -O butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default -q \
&& unzip butler.zip \
&& mv butler /usr/local/bin/butler \
&& chmod +x /usr/local/bin/butler \
&& rm butler.zip \
&& /usr/local/bin/butler -VExtend the docker image with gdtoolkit to also lint and format your godot files.
FROM dunkelgrau/godot:4.2.2
RUN apt-get install -y --no-install-recommends pipx
RUN pipx install "gdtoolkit==4.*"
ENV PATH="$PATH:/root/.local/bin/"Q: How can I run the editor?
A: The docker image is no replacement for the editor. In the docker container godot should always be executed with the argument --headless.
Q: Is there a C#/Mono Version?
A: Since I use mainly gdscript, I will not provide a C#/mono version. But there is a C#/mono version by Liphium: https://github.com/Liphium/godot-dotnet-dockerfile
Q: Why does Godot throw Parse Error: Identifier "..." not declared in the current scope. in my CI/CD pipeline?
A: This typically happens if you are using a plugin, especially GUT. This was fixed in version 4.3 by the PR #923303
Q: Why does Godot hang in my CI/CD pipeline?
A: This is a known issue (see issue #100122 or issue #89767). The infinite wait was due to an awaited interaction of blender, even if they were not used. It was solved in Godot 4.5.
To use .blend files, the path to the Blender executable must be explicitly configured. Below is a sample Dockerfile snippet how to set the Blender path in a Godot 4.5.1 environment:
FROM dunkelgrau/godot:4.5.1
RUN apt install blender -y
RUN sed -i '/filesystem\/import\/blender\/blender_path =/ s|= .*|= "/usr/bin/blender"|' ~/.config/godot/editor_settings-4.5.tres