abarichello / godot-ci

Docker image to export Godot Engine games. Templates for Gitlab CI and GitHub Actions to deploy to GitLab Pages/GitHub Pages/Itch.io.
https://hub.docker.com/r/barichello/godot-ci
MIT License
759 stars 133 forks source link

Add an image with software OpenGL enabled (sample working Dockerfile included) #102

Closed myaaaaaaaaa closed 4 months ago

myaaaaaaaaa commented 1 year ago

The following Dockerfile builds on top of godot-ci:latest, bundles in the standard graphics-capable Godot build, installs the needed dependencies for running it on a server, and adds a godot_x11 wrapper script for running it with a dummy x11 server. I've confirmed that this is enough to run Godot with working software OpenGL (specifically, https://github.com/RodZill4/material-maker , which relies on GLSL, will correctly export textures)

Needed for adding CI tests to Material Maker, although there are almost certainly other projects that would find this useful.

FROM barichello/godot-ci

RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 \
    libxcursor1 \
    libxi6 \
    libxinerama1 \
    libxrandr2 \
    xvfb \
    && rm -rf /var/lib/apt/lists/*

ARG GODOT_VERSION="3.5.1"
ARG RELEASE_NAME="stable"
ARG SUBDIR=""

RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_x11.64.zip \
    && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_x11.64.zip \
    && rm Godot_v${GODOT_VERSION}-${RELEASE_NAME}_x11.64.zip \
    && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_x11.64 /usr/local/bin/godot_x11_bin

RUN echo '#!/bin/sh \n xvfb-run godot_x11_bin "$@"' > /usr/local/bin/godot_x11 \
    && chmod +x /usr/local/bin/godot_x11
realkotob commented 1 year ago

@myaaaaaaaaa This looks good to me, would you like to open a PR?

myaaaaaaaaa commented 1 year ago

@realkotob Thanks! This does add several gigabytes of dependencies to the image though, so it's probably not the best idea to just patch the main Dockerfile and call it a day. I think it's better to wait for someone more familiar with Docker and its best practices who will be able to add this to the release workflow properly as a separate image.