rebase to dotnet containter
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 57s

This commit is contained in:
Merith-TK 2024-12-09 21:58:51 +00:00
parent 6531e9422a
commit 7e2e006c62
10 changed files with 33 additions and 109 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/data
/steamcred.env

View file

@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/debian:12 FROM mcr.microsoft.com/dotnet/runtime
ENV \ ENV \
LANG="en_US.UTF-8" \ LANG="en_US.UTF-8" \
@ -9,48 +9,25 @@ WORKDIR /root
# Install Base Packages # Install Base Packages
RUN apt update && apt upgrade -y \ RUN apt update && apt upgrade -y \
&& dpkg --add-architecture i386 \ && dpkg --add-architecture i386
&& apt install -y \ RUN DEBIAN_FRONTEND=noninteractive \
apt install -y \
apt-transport-https \ apt-transport-https \
dirmngr \
gnupg \
ca-certificates \
iproute2 \
unzip \
sqlite3 \
fontconfig \
lib32gcc-s1 \
curl \ curl \
wget \ jq \
screen \ lib32gcc-s1 \
sudo \ libopus-dev \
youtube-dl \ libopus0 \
jq locales \
mono-complete \
# Install Mono opus-tools
RUN export GNUPGHOME=$(mktemp -d) \
&& gpg --recv-keys --no-default-keyring --keyring /etc/apt/trusted.gpg.d/mono-keyring.gpg --keyserver keyserver.ubuntu.com 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb [signed-by=/etc/apt/trusted.gpg.d/mono-keyring.gpg] https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list \
&& wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y mono-complete
# Install Crystite
RUN echo 'deb [signed-by=/usr/share/keyrings/algiz.gpg] https://repo.algiz.nu/crystite bookworm main' | tee /etc/apt/sources.list.d/crystite.list \
&& mkdir -p /usr/share/keyrings \
&& wget -O /usr/share/keyrings/algiz.gpg https://repo.algiz.nu/algiz.gpg \
&& apt-get update \
&& apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y crystite
# make data directories # make data directories
RUN mkdir -p /data/resonite /data/steamcmd RUN mkdir -p /data/resonite /data/steamcmd
VOLUME [ "/etc/crystite", "/data/resonite", "/data/steamcmd", "/data/home" ] VOLUME [ "/data/resonite", "/data/steamcmd", "/data/home" ]
# DEFAULT ENVS # DEFAULT ENVS
ENV DISABLE_STEAMCMD=false ENV DISABLE_STEAMCMD=false
ENV USE_CRYSTITE=false
ENV CONFIG_FILE="/data/Config.json" ENV CONFIG_FILE="/data/Config.json"
ENV COMMAND="/scripts/99_start.sh" ENV COMMAND="/scripts/99_start.sh"
ENV RESONITE_ARGS="" ENV RESONITE_ARGS=""
@ -58,7 +35,7 @@ ENV RESONITE_MOD_LOADER=false
ENV MOD_URLS="" ENV MOD_URLS=""
ENV STOP_LAUNCH=false ENV STOP_LAUNCH=false
COPY crystite /mnt/crystite COPY defaults /mnt/defaults
COPY scripts /scripts COPY scripts /scripts
RUN chmod +x /scripts/* RUN chmod +x /scripts/*
ENTRYPOINT ["/scripts/00_setup.sh"] ENTRYPOINT ["/scripts/00_setup.sh"]

View file

@ -1,23 +0,0 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Debug" ],
"WriteTo": [
{
"Name": "Console"
}
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"System": "Information",
"Microsoft": "Information",
"System.Net.Http.HttpClient": "Warning"
}
}
},
"Headless": {
"resonitePath": "/data/resonite",
"assetCleanupInterval": "06:00:00",
"maxAssetAge": "07:00:00:00"
}
}

View file

@ -12,18 +12,16 @@ services:
# have volume entires in dockerfile, if removed this data will persist # have volume entires in dockerfile, if removed this data will persist
# until the volume is removed # until the volume is removed
# - ./data/crystite/:/etc/crystite:rw - ./data/resonite:/data/resonite:rw
# - ./data/resonite:/data/resonite:rw - ./data/steamcmd:/data/steamcmd:rw
# - ./data/steamcmd:/data/steamcmd:rw
# mount scripts for runtime, optional # mount scripts for runtime, optional
- .build/scripts:/scripts:ro - ./scripts:/scripts:ro
- .build/crystite:/mnt/crystite:ro
## EDIT THESE ENVIRONMENT VARIABLES ## ## EDIT THESE ENVIRONMENT VARIABLES ##
environment: environment:
# DO NOT REMOVE THIS VALUE # DO NOT REMOVE THIS VALUE
RUN_AS: 1000 # RUN_AS: 1000
# THIS CONTROLS THE USER ID THAT THE SERVER RUNS AS # THIS CONTROLS THE USER ID THAT THE SERVER RUNS AS
# This is specifically so *you* have control over the files] # This is specifically so *you* have control over the files]
@ -33,10 +31,6 @@ services:
# Prevents SteamCMD from updating the gamefiles # Prevents SteamCMD from updating the gamefiles
DISABLE_STEAMCMD: "false" DISABLE_STEAMCMD: "false"
# Wether to use crystite or not.
# if no STEAM_BETA key is provided, this is force set to true
USE_CRYSTITE: "false"
# Where to located the config file, defaults to /data/Config.json # Where to located the config file, defaults to /data/Config.json
# if config file does not exist, it will generate a template one at that location # if config file does not exist, it will generate a template one at that location
CONFIG_FILE: "/data/Config.json" CONFIG_FILE: "/data/Config.json"
@ -45,8 +39,7 @@ services:
COMMAND: "/scripts/99_start.sh" COMMAND: "/scripts/99_start.sh"
# Wether to enable the Resonite Mod Loader # Wether to enable the Resonite Mod Loader
# Crystite Support is expiremental at best. RESONITE_MOD_LOADER: false
RESONITE_MOD_LOADER: true
# list of mods to load, # list of mods to load,
MOD_URLS: | MOD_URLS: |
https://github.com/New-Project-Final-Final-WIP/HeadlessTweaks/releases/latest/download/HeadlessTweaks.dll https://github.com/New-Project-Final-Final-WIP/HeadlessTweaks/releases/latest/download/HeadlessTweaks.dll

3
scripts/00_setup.sh Normal file → Executable file
View file

@ -17,7 +17,7 @@ export DEFAULT_RESONITE_ARGS="-LogsPath /data/resonite/logs \
-HeadlessConfig $CONFIG_FILE \ -HeadlessConfig $CONFIG_FILE \
$RESONITE_ARGS" $RESONITE_ARGS"
mkdir -p /data/home /data/resonite /data/steamcmd /etc/crystite/conf.d mkdir -p /data/home /data/resonite /data/steamcmd
## Have to do this here, as otherwise stuff doesnt work for some reason ## Have to do this here, as otherwise stuff doesnt work for some reason
# using source so runtime vars can be updated as needed # using source so runtime vars can be updated as needed
source /scripts/01_install.sh source /scripts/01_install.sh
@ -35,7 +35,6 @@ if [ "$RUN_AS" != "" ]; then
export HOME="/home/user" export HOME="/home/user"
chown $USER_ID:$GROUP_ID /data -R chown $USER_ID:$GROUP_ID /data -R
chown $USER_ID:$GROUP_ID /etc/crystite -R
echo "executing command: $COMMAND" echo "executing command: $COMMAND"
exec sudo -E -u user $COMMAND exec sudo -E -u user $COMMAND

16
scripts/01_install.sh Normal file → Executable file
View file

@ -8,19 +8,11 @@ if [ "$DISABLE_STEAMCMD" != "true" ]; then
fi fi
# if steam beta is empty, or matchs "beta_access_key" we don't need to dwonload the beta # if steam beta is empty, or matchs "beta_access_key" we don't need to dwonload the beta
if [ -z "$STEAM_BETA" ] || [ "$STEAM_BETA" == "beta_access_key" ]; then if [ -z "$STEAM_BETA" ] || [ "$STEAM_BETA" == "beta_access_key" ]; then
echo "Downloading Resonite" echo "[ERROR] Unable to Download Headless, No Beta Key"
/data/steamcmd/steamcmd.sh +login anonymous +force_install_dir /data/resonite +app_update 2519830 +quit exit
else else
echo "Downloading Resonite Headless" echo "Downloading Resonite Headless"
/data/steamcmd/steamcmd.sh +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} +force_install_dir /data/resonite +app_update 2519830 -beta headless -betapassword ${STEAM_BETA} validate +quit /data/steamcmd/steamcmd.sh +force_install_dir /data/resonite +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} +app_license_request 2519830 +app_update 2519830 -beta headless -betapassword ${STEAM_BETA} validate +quit
fi
fi
# if crystite is enabled, we don't need to check for resonite
if [ "$USE_CRYSTITE" != "true" ]; then
if [ ! -f "/data/resonite/Headless/Resonite.exe" ]; then
echo "Headless/Resonite.exe not found!"
echo "Forcing use of Crystite"
USE_CRYSTITE="true"
fi fi
ln -s /data/resonite/Headless/Resonite.dll /data/resonite/Headless/dotnet-Resonite.dll
fi fi

13
scripts/02_setup_config.sh Normal file → Executable file
View file

@ -6,29 +6,20 @@ echo "Setting up Resonite Config"
# if CONFIG_FILE is not set, use default config path # if CONFIG_FILE is not set, use default config path
if [ ! -f $CONFIG_FILE ]; then if [ ! -f $CONFIG_FILE ]; then
echo "No Resonite Config found, copying from template" echo "No Resonite Config found, copying from template"
cp /mnt/crystite/resonite.json $CONFIG_FILE cp /mnt/defaults/resonite.json $CONFIG_FILE
# cat /mnt/crystite/resonite.json | jq '.' > $CONFIG_FILE
fi
echo "Generating Crystite configs"
if [ ! -f "/etc/crystite/appsettings.json" ]; then
cat /mnt/crystite/appsettings.json | jq '.' > /etc/crystite/appsettings.json
fi fi
CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE") CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE")
if [ ! -n "$CONFIG_DATA" ]; then if [ ! -n "$CONFIG_DATA" ]; then
echo "Config file is empty, copying from template" echo "Config file is empty, copying from template"
cp /mnt/crystite/resonite.json $CONFIG_FILE cp /mnt/defaults/resonite.json $CONFIG_FILE
CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE") CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE")
fi fi
CONFIG_DATA=$(echo "$CONFIG_DATA" | jq ".comment = \"DO NOT EDIT: This file was automatically generated. Please edit $CONFIG_FILE instead.\"")
echo "{ \"Resonite\": $CONFIG_DATA }" > /etc/crystite/conf.d/_generated_resonite.json
## Setup Modloader Configs ## Setup Modloader Configs
if [ "$RESONITE_MOD_LOADER" == "true" ]; then if [ "$RESONITE_MOD_LOADER" == "true" ]; then
echo "Setting up Modloader Configs" echo "Setting up Modloader Configs"
echo "{\"Resonite\": {\"pluginAssemblies\": [\"/data/resonite/Headless/Libraries/ResoniteModLoader.dll\"]}}" | jq '.' > /etc/crystite/conf.d/_generated_rml.json
DEFAULT_RESONITE_ARGS=$(echo "$DEFAULT_RESONITE_ARGS -LoadAssembly /data/resonite/Headless/Libraries/ResoniteModLoader.dll") DEFAULT_RESONITE_ARGS=$(echo "$DEFAULT_RESONITE_ARGS -LoadAssembly /data/resonite/Headless/Libraries/ResoniteModLoader.dll")
else else
echo "Modloader is disabled" echo "Modloader is disabled"
rm -f /etc/crystite/conf.d/_generated_rml.json
fi fi

4
scripts/03_download_mods.sh Normal file → Executable file
View file

@ -53,11 +53,11 @@ done
# if resonte mod loader is enabled, create and link rml_mods, libs, and config # if resonte mod loader is enabled, create and link rml_mods, libs, and config
if [ "$RESONITE_MOD_LOADER" == "true" ]; then if [ "$RESONITE_MOD_LOADER" == "true" ]; then
for dir in rml_mods rml_libs rml_config; do for dir in rml_mods rml_libs rml_config; do
if [ -d "/data/resonite/$dir" ]; then if [ -d "/data/resonite/Headless/$dir" ]; then
continue continue
fi fi
mkdir -p "/data/resonite/Headless/$dir" mkdir -p "/data/resonite/Headless/$dir"
ln -s "/data/resonite/Headless/$dir" "/data/resonite/$dir" ln -s "./Headless/$dir" "./$dir"
done done
if [ ! -f "/data/resonite/Libraries/ResoniteModLoader.dll" ]; then if [ ! -f "/data/resonite/Libraries/ResoniteModLoader.dll" ]; then
mkdir -p "/data/resonite/Libraries" mkdir -p "/data/resonite/Libraries"

15
scripts/99_start.sh Normal file → Executable file
View file

@ -5,14 +5,7 @@ if [ "$STOP_LAUNCH" == "true" ]; then
exit 0 exit 0
fi fi
# Check if Crystite is enabled cd /data/resonite/Headless || exit
if [ "$USE_CRYSTITE" == "true" ]; then echo "Running Resonite"
echo "Running Crystite" echo "exec: dotnet Resonite.dll $DEFAULT_RESONITE_ARGS $RESONITE_ARGS"
echo "exec: /usr/lib/crystite/crystite" dotnet Resonite.dll $DEFAULT_RESONITE_ARGS $RESONITE_ARGS
/usr/lib/crystite/crystite
else
cd /data/resonite/Headless || exit
echo "Running Resonite"
echo "exec: mono Resonite.exe $DEFAULT_RESONITE_ARGS $RESONITE_ARGS"
mono Resonite.exe $DEFAULT_RESONITE_ARGS $RESONITE_ARGS
fi