]> Untitled Git - godot-builder.git/commitdiff
Squashed commit of the following: 0.3.0
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Fri, 14 Mar 2025 11:07:30 +0000 (06:07 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Fri, 14 Mar 2025 11:33:20 +0000 (06:33 -0500)
    * Added redis instance for builder to poll for jobs
    * Added nginx conf
    * Moved builder to its own folder

Dockerfile [deleted file]
builder/Dockerfile [new file with mode: 0644]
builder/entrypoint.sh [new file with mode: 0755]
builder/godot-export.sh [new file with mode: 0755]
docker-compose-prod.yml
docker-compose.yml
entrypoint.sh [deleted file]
nginx/conf.d/godot.conf [new file with mode: 0644]

diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644 (file)
index 49ef939..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-FROM cjpalmer/godot:0.1.0
-
-RUN apt update -y && apt install -y zip
-
-ADD ./entrypoint.sh .
-
-ENTRYPOINT [ "./entrypoint.sh" ]
diff --git a/builder/Dockerfile b/builder/Dockerfile
new file mode 100644 (file)
index 0000000..c0af21b
--- /dev/null
@@ -0,0 +1,7 @@
+FROM cjpalmer/godot:0.1.0
+
+RUN apt update -y && apt install -y zip redis
+
+ADD ./*.sh ./
+
+ENTRYPOINT [ "./entrypoint.sh" ]
diff --git a/builder/entrypoint.sh b/builder/entrypoint.sh
new file mode 100755 (executable)
index 0000000..9db721d
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+
+function intr() {
+    echo Halting
+    exit
+}
+
+trap intr SIGINT
+
+echo Starting builder polling...
+
+# polls a redis queue for jobs, starts the builder when it's got some
+while true
+do
+    SNAPSHOT_URI=$(redis-cli -h redis LPOP snapshots)
+    [[ -n "$SNAPSHOT_URI" ]] && ./godot-export.sh "$SNAPSHOT_URI"
+    sleep 1
+done
+
+
diff --git a/builder/godot-export.sh b/builder/godot-export.sh
new file mode 100755 (executable)
index 0000000..e4aca6f
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+# builds a Godot project with all its native export config options
+################################################################################
+# get project 
+
+URI_PROJECT_SNAPSHOT=$1
+
+[[ -z "$URI_PROJECT_SNAPSHOT" ]] && echo No URI_PROJECT_SNAPSHOT, exiting && exit 1
+
+echo --------------------------------------------------------------------------------
+echo Getting project - $URI_PROJECT_SNAPSHOT
+
+DIR_BUILD=/build
+DIR_PROJECT_ROOT=/project
+
+# clean project root
+rm -rf $DIR_PROJECT_ROOT/* && \
+    wget $URI_PROJECT_SNAPSHOT && \
+    tar -xf *.tar.gz -C $DIR_PROJECT_ROOT && \
+    rm *.tar.gz
+
+DIR_PROJECT=$(find $DIR_PROJECT_ROOT -type f -name project.godot | sed 's|/project.godot||')
+PROJECT_ID=$(echo $DIR_PROJECT | awk -F/ '{print $NF}')
+
+echo Project directory - $DIR_PROJECT
+
+################################################################################
+# execute project build
+
+DIR_DEBUG=$DIR_BUILD/$PROJECT_ID/debug
+DIR_RELEASE=$DIR_BUILD/$PROJECT_ID/release
+
+GODOT="godot --headless --path $DIR_PROJECT"
+EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
+
+echo --------------------------------------------------------------------------------
+echo Godot version - $($GODOT --headless --version)
+
+# iterate through all build types present in config file
+# if arg is given, override automated export discovery
+if [[ -n "$2" ]]
+then
+    EXPORT_NAMES=$2
+else
+    EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
+fi
+
+for EXPORT_NAME in $EXPORT_NAMES
+do
+    echo --------------------------------------------------------------------------------
+    echo Starting project build for export $EXPORT_NAME
+
+    # create build folders
+    [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
+    [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
+
+    # get export name from config file
+    EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
+        '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
+        $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
+
+    DEBUG_BUILD_PATH=$DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
+    RELEASE_BUILD_PATH=$DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
+
+    ######
+    # do debug and release builds!
+    echo $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
+    $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
+
+    echo $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
+    $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
+
+    ######
+    # zip debug and release builds and shasum them
+    for DIR in $DIR_DEBUG $DIR_RELEASE
+    do
+        ZIP_PATH=$DIR/$EXPORT_NAME
+        echo
+        echo Zipping $ZIP_PATH
+        zip -r $EXPORT_NAME $ZIP_PATH && mv *.zip $DIR
+    done
+done
+
+echo --------------------------------------------------------------------------------
+echo Computing shasums for zip files
+
+for DIR in $DIR_DEBUG $DIR_RELEASE
+do
+    $(cd $DIR && sha1sum *.zip >shasum.txt)
+
+    echo
+    echo SHASUM from $DIR -
+
+    find $DIR -type f -name shasum.txt | xargs cat
+done
+
index 453c75a25960b77f3371164824b9fdcfee2b7a22..db77db559570b3de98dd5b60193fefcfd0c12670 100644 (file)
@@ -1,13 +1,29 @@
 version: '3'
 version: '3'
+networks:
+    proxy:
+        external: true
+    backend:
+        driver: overlay
 services:
 services:
-    godot-builder:
-        build: .
-        image: cjpalmer/godot-builder:0.2.1
+    web:
+        image: nginx:1.27-alpine
+        volumes:
+        - ./nginx/conf.d/:/etc/nginx/conf.d/
+        - godot-build:/build
+        networks:
+        - proxy
+        - backend
+    redis:
+        image: redis:alpine
+        networks:
+        - backend
+    builder:
+        image: cjpalmer/godot-builder:0.3.0
         volumes:
         - godot-build:/build
         - godot-project:/project
         volumes:
         - godot-build:/build
         - godot-project:/project
-        environment:
-        - URI_PROJECT_SNAPSHOT=https://git.purplebirdman.com/wolf-seeking-sheep.git/snapshot/refs/heads/big-rick.tar.gz
+        networks:
+        - backend
 volumes:
     godot-build:
         driver: local
 volumes:
     godot-build:
         driver: local
index af38aac69961890c861e15ee7437023406aa062f..f13049edfa8256db88968963be01a1ac32af77d0 100644 (file)
@@ -1,13 +1,20 @@
 version: '3'
 services:
 version: '3'
 services:
-    godot-builder:
-        build: .
-        image: cjpalmer/godot-builder:0.2.1
+    web:
+        image: nginx:1.27-alpine
+        volumes:
+        - ./nginx/conf.d/:/etc/nginx/conf.d/
+        - godot-build-dev:/build
+        ports:
+        - 80:80
+    redis:
+        image: redis:alpine
+    builder:
+        build: ./builder
+        image: cjpalmer/godot-builder:0.3.0
         volumes:
         - godot-build-dev:/build
         - godot-project:/project
         volumes:
         - godot-build-dev:/build
         - godot-project:/project
-        environment:
-        - URI_PROJECT_SNAPSHOT=https://git.purplebirdman.com/wolf-seeking-sheep.git/snapshot/refs/heads/big-rick.tar.gz
 volumes:
     godot-build-dev:
         driver: local
 volumes:
     godot-build-dev:
         driver: local
diff --git a/entrypoint.sh b/entrypoint.sh
deleted file mode 100755 (executable)
index db00882..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/bash
-
-# builds a Godot project with all its native export config options
-################################################################################
-# get project 
-
-[[ -z "$URI_PROJECT_SNAPSHOT" ]] && echo No URI_PROJECT_SNAPSHOT, exiting && exit 1
-
-echo --------------------------------------------------------------------------------
-echo Getting project - $URI_PROJECT_SNAPSHOT
-
-DIR_BUILD=/build
-DIR_PROJECT_ROOT=/project
-
-wget $URI_PROJECT_SNAPSHOT && \
-    tar -xf *.tar.gz -C $DIR_PROJECT_ROOT && \
-    rm *.tar.gz
-
-DIR_PROJECT=$(find $DIR_PROJECT_ROOT -type f -name project.godot | sed 's|/project.godot||')
-PROJECT_ID=$(echo $DIR_PROJECT | awk -F/ '{print $NF}')
-
-echo Project directory - $DIR_PROJECT
-
-################################################################################
-# execute project build
-
-DIR_DEBUG=$DIR_BUILD/$PROJECT_ID/debug
-DIR_RELEASE=$DIR_BUILD/$PROJECT_ID/release
-
-GODOT="godot --headless --path $DIR_PROJECT"
-EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
-
-echo --------------------------------------------------------------------------------
-echo Godot version - $($GODOT --headless --version)
-
-# iterate through all build types present in config file
-# if arg is given, override automated export discovery
-if [[ -n "$1" ]]
-then
-    EXPORT_NAMES=$1
-else
-    EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
-fi
-
-for EXPORT_NAME in $EXPORT_NAMES
-do
-    echo --------------------------------------------------------------------------------
-    echo Starting project build for export $EXPORT_NAME
-
-    # create build folders
-    [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
-    [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
-
-    # get export name from config file
-    EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
-        '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
-        $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
-
-    DEBUG_BUILD_PATH=$DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
-    RELEASE_BUILD_PATH=$DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
-
-    ######
-    # do debug and release builds!
-    echo $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
-    $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
-
-    echo $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
-    $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
-
-    ######
-    # zip debug and release builds and shasum them
-    for DIR in $DIR_DEBUG $DIR_RELEASE
-    do
-        ZIP_PATH=$DIR/$EXPORT_NAME
-        echo
-        echo Zipping $ZIP_PATH
-        zip -r $EXPORT_NAME $ZIP_PATH && mv *.zip $DIR
-    done
-done
-
-echo --------------------------------------------------------------------------------
-echo Computing shasums for zip files
-
-for DIR in $DIR_DEBUG $DIR_RELEASE
-do
-    $(cd $DIR && sha1sum *.zip >shasum.txt)
-
-    echo
-    echo SHASUM from $DIR -
-
-    find $DIR -type f -name shasum.txt | xargs cat
-done
-
diff --git a/nginx/conf.d/godot.conf b/nginx/conf.d/godot.conf
new file mode 100644 (file)
index 0000000..3acaff1
--- /dev/null
@@ -0,0 +1,70 @@
+server {
+    listen  80;
+    root    /build;
+    index   index.html;
+
+    location / {
+        autoindex on;
+    }
+
+    #------------------------------------------------
+    # Adds required support for Godot 4 WebGL Support
+    #------------------------------------------------
+    location ~ .+/web/ {
+        add_header Cross-Origin-Resource-Policy same-origin;
+        add_header Cross-Origin-Opener-Policy same-origin;
+        add_header Cross-Origin-Embedder-Policy require-corp;
+    }
+
+    #----------------------------------
+    # Unity WebGL Support
+    #----------------------------------
+
+    # On-disk Brotli-precompressed data files should be served with compression enabled:
+    location ~ .+\.(data|symbols\.json)\.br$ {
+        # Because this file is already pre-compressed on disk, disable the on-demand compression on it.
+        # Otherwise nginx would attempt double compression.
+        gzip off;
+        add_header Content-Encoding br;
+        default_type application/octet-stream;
+    }
+
+    # On-disk Brotli-precompressed JavaScript code files:
+    location ~ .+\.js\.br$ {
+        gzip off; # Do not attempt dynamic gzip compression on an already compressed file
+        add_header Content-Encoding br;
+        default_type application/javascript;
+    }
+
+    # On-disk Brotli-precompressed WebAssembly files:
+    location ~ .+\.wasm\.br$ {
+        gzip off; # Do not attempt dynamic gzip compression on an already compressed file
+        add_header Content-Encoding br;
+        # Enable streaming WebAssembly compilation by specifying the correct MIME type for
+        # Wasm files.
+        default_type application/wasm;
+    }
+
+    # On-disk gzip-precompressed data files should be served with compression enabled:
+    location ~ .+\.(data|symbols\.json)\.gz$ {
+        gzip off; # Do not attempt dynamic gzip compression on an already compressed file
+        add_header Content-Encoding gzip;
+        default_type application/octet-stream;
+    }
+
+    # On-disk gzip-precompressed JavaScript code files:
+    location ~ .+\.js\.gz$ {
+        gzip off; # Do not attempt dynamic gzip compression on an already compressed file
+        add_header Content-Encoding gzip;
+        default_type application/javascript;
+    }
+
+    # On-disk gzip-precompressed WebAssembly files:
+    location ~ .+\.wasm\.gz$ {
+        gzip off; # Do not attempt dynamic gzip compression on an already compressed file
+        add_header Content-Encoding gzip;
+        # Enable streaming WebAssembly compilation by specifying the correct MIME type for
+        # Wasm files.
+        default_type application/wasm;
+    }
+}