From b9014ae536902147c3bc447e50b4ae9fc6a6e5cd Mon Sep 17 00:00:00 2001 From: Clifton Palmer Date: Sun, 9 Mar 2025 07:06:48 -0500 Subject: [PATCH] Dockerized it --- .gitignore | 4 +--- Dockerfile | 19 +++++++++++++++++ docker-compose.yml | 5 +++++ script.sh | 53 +++++++--------------------------------------- 4 files changed, 33 insertions(+), 48 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 84fd956..db505ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -download/ project/ -debug/ -release/ +build/ *.swp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8499cbe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:22.04 + +ARG GODOT_VERSION="4.4" + +# Install Godot & templates +RUN apt update -y && apt install -y wget unzip fontconfig +RUN wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip \ + && wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \ + && mkdir -p ~/.cache ~/.config/godot ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable \ + && unzip Godot_v${GODOT_VERSION}-stable_linux*.zip \ + && mv Godot_v${GODOT_VERSION}-stable_linux*64 /usr/local/bin/godot \ + && unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \ + && mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable \ + && rm Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux*.zip + +# Build application +WORKDIR /app + +ENTRYPOINT [ "godot" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c680cb3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +version: '3' +services: + godot: + build: . + image: cjpalmer/godot:0.1.0 diff --git a/script.sh b/script.sh index 75f2dfd..f1c0c39 100755 --- a/script.sh +++ b/script.sh @@ -1,60 +1,23 @@ #!/bin/bash -# gets a Godot release, fetches export templates, -# and builds a project with its native export options - +# builds a Godot project with all its native export config options ################################################################################ -PWD=`pwd` -DIR_DOWNLOAD=$PWD/download -DIR_TEMPLATES=$DIR_DOWNLOAD/templates -DIR_DEBUG=$PWD/debug -DIR_RELEASE=$PWD/release -DIR_PROJECT=$PWD/project - -GODOT_VERSION=4.4-stable -GODOT_ZIP=Godot_v${GODOT_VERSION}_linux.x86_64.zip -GODOT_EXE=Godot_v${GODOT_VERSION}_linux.x86_64 -GODOT_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_ZIP - -GODOT_EXPORT_TEMPLATES=Godot_v${GODOT_VERSION}_export_templates.tpz -GODOT_TEMPLATE_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_EXPORT_TEMPLATES - -GODOT=$DIR_DOWNLOAD/$GODOT_EXE -################################################################################ -# get Godot +DIR_BUILD=`pwd`/build +DIR_DEBUG=$DIR_BUILD/debug +DIR_RELEASE=$DIR_BUILD/release +DIR_PROJECT=`pwd`/project -[[ -d $DIR_DOWNLOAD ]] || mkpath -p $DIR_DOWNLOAD -[[ -f $DIR_DOWNLOAD/$GODOT_ZIP ]] || wget -P $DIR_DOWNLOAD $GODOT_URI -[[ -f $DIR_DOWNLOAD/$GODOT_EXE ]] || unzip $DIR_DOWNLOAD/$GODOT_ZIP -d $DIR_DOWNLOAD +GODOT="docker run -v${DIR_PROJECT}:${DIR_PROJECT} -v${DIR_BUILD}:${DIR_BUILD} cjpalmer/godot:0.1.0" +GODOT_OPTS="--headless --path $DIR_PROJECT" +EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg" echo Godot version - $($GODOT --headless --version) -################################################################################ -# get export templates - -[[ -f $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES ]] || wget -P $DIR_DOWNLOAD $GODOT_TEMPLATE_URI -[[ -d $DIR_TEMPLATES ]] || unzip -d $DIR_DOWNLOAD $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES - -GODOT_TEMPLATE_VERSION=$(cat $DIR_TEMPLATES/version.txt) -LOCAL_TEMPLATES=$HOME/.local/share/godot/export_templates/$GODOT_TEMPLATE_VERSION -if [[ ! -d $LOCAL_TEMPLATES ]] -then - mkdir -p $LOCAL_TEMPLATES - cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES - # TODO: leaves extra copy of templates -fi - -echo Godot export template version - $GODOT_TEMPLATE_VERSION -echo Local templates - $LOCAL_TEMPLATES - ################################################################################ # execute project build # iterate through all build types present in config file -EXPORT_PRESETS_CFG=$DIR_PROJECT/export_presets.cfg -GODOT_OPTS="--headless --path $DIR_PROJECT" - # if arg is given, override automated export discovery if [[ -n "$1" ]] then -- 2.47.2