added /activate.sh support

This commit is contained in:
Lachee 2025-05-08 11:36:38 +10:00
parent ecb09b074f
commit 12b1f2ca11
No known key found for this signature in database
GPG Key ID: F1694B0D3BCBCD55
3 changed files with 36 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
gameci

View File

@ -1,8 +1,6 @@
ARG BASE_IMAGE=unityci/editor
FROM $BASE_IMAGE
# Setup Dependants
RUN apt-get update && \
apt-get install -y \
git \
@ -27,16 +25,17 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
# Install Blender
ARG BLENDER_SHORT_VERSION=3.4
ARG BLENDER_FULL_VERSION=3.4.1
RUN echo "BLENDER_SHORT_VERSION: $BLENDER_SHORT_VERSION"
RUN echo "BLENDER_FULL_VERSION: $BLENDER_FULL_VERSION"
RUN apt-get update && \
RUN echo "BLENDER_FULL_VERSION: $BLENDER_FULL_VERSION" && \
echo echo "BLENDER_SHORT_VERSION: $BLENDER_SHORT_VERSION" && \
apt-get install -y wget && \
wget https://download.blender.org/release/Blender$BLENDER_SHORT_VERSION/blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz && \
tar -xf blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz && \
rm blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz
ENV PATH="$PATH:/blender-$BLENDER_FULL_VERSION-linux-x64"
# Add custom scripts
COPY scripts/activate.sh /activate.sh
RUN chmod +x /activate.sh
# Done
ENTRYPOINT [ "/entrypoint.sh" ]

29
scripts/activate.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Convert the UNITY_LICENSE to a UNITY_SERIAL
if [ -z "$UNITY_SERIAL" ] && [ ! -z "$UNITY_LICENSE" ]; then
echo "Extracting serial from license file"
UNITY_SERIAL=$(echo "$UNITY_LICENSE" | grep -oP '(?<=<DeveloperData Value=")[^"]+' || echo "")
if [ ! -z "$UNITY_SERIAL" ]; then
echo "Found serial in license file"
fi
echo "$UNITY_SERIAL" | base64 -d >/tmp/serial_decoded
UNITY_SERIAL=$(dd if=/tmp/serial_decoded bs=1 skip=4 2>/dev/null)
rm /tmp/serial_decoded
fi
export UNITY_SERIAL="$UNITY_SERIAL"
# Activate the script.
if [ "$SKIP_ACTIVATION" != "true" ]; then
source /steps/activate.sh
# If we didn't activate successfully, exit with the exit code from the activation step.
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
exit $UNITY_EXIT_CODE
fi
export SKIP_ACTIVATION="true"
else
echo "Skipping activation"
fi