Last active
March 31, 2025 18:43
-
-
Save RevoluPowered/deda2228a3b25b3899373b09ff5932c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT license | |
# Authored by Gordon MacPherson | |
# Why? I want to upload my game to itch.io with a single command and with tools I already have installed. | |
# I don't want to worry about github actions anymore. | |
# Version 0.1 very new, but functional. | |
# How to use this: | |
# 0. Put this file above your project the directory structure should be this: | |
# - app/ your game folder is here | |
#. - Dockerfile - this dockerfile | |
#. - tools/ put the butler executables for linux amd64 in there found here: https://itchio.itch.io/butler | |
# 1. Update example_user/project-name entries to your itch.io username and project name. | |
# 2. Ensure the project targets are correct: see the lines with --export-release macOS | |
# update them to your project specific export from your "Export" dialog. | |
# 3. open a terminal and go to the project folder, and run the command `docker build .` if you want the full log run this `docker build . --progress=plain` | |
# Future ideas: Implement build containers for export templates | |
# Advanced users: | |
# for faster build performance you can use external servers using | |
# the command `docker context` it allows you to specify remote ssh machines with docker installed to run your docker commands on | |
# Caution: | |
# this uses a lot of disk space | |
# i'll fix that in later revisions | |
# run `docker system prune` to remove the image if it consumes far too much | |
# I found as much as 47 gb of space was used for a game that was 6 gb (6gb x 3)= 18gb, so I guess the docker cache is to blame and the lack of volumes | |
FROM ubuntu:latest | |
WORKDIR /app | |
ENV PATH="$PATH:/app/tools/" | |
COPY tools /app/tools | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
# by default HTTPS will not work without these two lines, you need them for grabbing godot's stable binary. | |
RUN apt-get install ca-certificates -y | |
RUN update-ca-certificates | |
RUN apt-get install curl unzip -y | |
RUN ./tools/butler --version | |
# IMPORTANT NOTE: put your butler API key here. | |
ENV BUTLER_API_KEY="" | |
RUN ./tools/butler login | |
RUN curl -Lo /app/Godot.zip https://github.com/godotengine/godot/releases/download/4.4.1-stable/Godot_v4.4.1-stable_linux.x86_64.zip | |
RUN curl -Lo Godot_v4.4.1-stable_export_templates.tpz https://github.com/godotengine/godot/releases/download/4.4.1-stable/Godot_v4.4.1-stable_export_templates.tpz | |
RUN ls -a ./ | |
RUN unzip --help | |
RUN unzip /app/Godot | |
RUN ls -a ./ | |
RUN mv Godot_v4.4.1-stable_linux.x86_64 Godot | |
RUN chmod +x Godot | |
# RUN echo $PATH | |
# NOTE: if your fonts on linux are broken then re-enable this. | |
# RUN apt-get install -y \ | |
# build-essential \ | |
# pkg-config \ | |
# libx11-dev \ | |
# libxcursor-dev \ | |
# libxinerama-dev \ | |
# libgl1-mesa-dev \ | |
# libglu1-mesa-dev \ | |
# libasound2-dev \ | |
# libpulse-dev \ | |
# libudev-dev \ | |
# libxi-dev \ | |
# libxrandr-dev \ | |
# libwayland-dev | |
RUN ./Godot --headless --version | |
RUN ./Godot --headless --help | |
RUN mkdir -p release/mac release/windows release/linux | |
# NOTE: if you want to save space this could be a volume | |
# VOLUME["/app/game"] # untested | |
# RUN rm -rf /app/game/* | |
COPY ./app /app/game/ | |
RUN rm -rf /app/game/.godot/ | |
RUN mkdir -p /root/.local/share/godot/export_templates/4.4.1.stable/ | |
RUN unzip Godot_v4.4.1-stable_export_templates.tpz -d /root/.local/share/godot/export_templates/4.4.1.stable/ | |
# NOTE: we want to persist this it's quite expensive to store this also means it isn't cached but can be re-used for faster iteration. | |
VOLUME ["/app/game/.godot/"] | |
RUN ./Godot --headless --import --path /app/game/ | |
RUN ls -a /root/.local/share/godot/export_templates/4.4.1.stable/ | |
RUN mv /root/.local/share/godot/export_templates/4.4.1.stable/templates/* /root/.local/share/godot/export_templates/4.4.1.stable/ | |
RUN ls -a /root/.local/share/godot/export_templates/4.4.1.stable/ | |
# IMPORTANT NOTE: update these to your templates and they'll be put in the correct folder | |
# adding another platform is easy, just make the directory. | |
# for android you'll need to run the --install android template command. | |
RUN ./Godot --headless --path /app/game/ --export-release macOS "/app/release/mac/Your Amazing Game.app" | |
RUN ./Godot --headless --path /app/game/ --export-release "Windows Desktop" "/app/release/windows/Your_Amazing_Game.exe" | |
RUN ./Godot --headless --path /app/game/ --export-release Linux "/app/release/linux/Your Amazing Game.x86_64" | |
RUN ls /app/release/mac | |
RUN ls /app/release/windows | |
RUN ls /app/release/linux | |
RUN du -sh /app/release/mac | |
RUN du -sh /app/release/windows | |
RUN du -sh /app/release/linux | |
# IMPORTANT NOTE: update these paths to your itch.io-project example | |
RUN ./tools/butler push /app/release/mac example_user/project-name:mac | |
RUN ./tools/butler push /app/release/windows example_user/project-name:windows | |
RUN ./tools/butler push /app/release/linux example_user/project-name:linux | |
RUN du -sh /app/release | |
RUN du -sh /app/release/mac | |
RUN du -sh /app/release/windows | |
RUN du -sh /app/release/linux | |
RUN rm -rf /app/release | |
RUN rm -rf /app/game/avatar/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment