-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
######## INSTALL ######## | ||
|
||
# Set the base image | ||
FROM ubuntu:24.04 | ||
|
||
# Set environment variables | ||
ENV USER root | ||
ENV HOME /root | ||
|
||
# Set working directory | ||
WORKDIR $HOME | ||
|
||
# Insert Steam prompt answers | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN echo steam steam/question select "I AGREE" | debconf-set-selections \ | ||
&& echo steam steam/license note '' | debconf-set-selections | ||
|
||
# Update the repository and install SteamCMD | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN dpkg --add-architecture i386 \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y --no-install-recommends ca-certificates locales steamcmd \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Add unicode support | ||
RUN locale-gen en_US.UTF-8 | ||
ENV LANG 'en_US.UTF-8' | ||
ENV LANGUAGE 'en_US:en' | ||
|
||
# Create symlink for executable | ||
RUN ln -s /usr/games/steamcmd /usr/bin/steamcmd | ||
|
||
# Update SteamCMD and verify latest version | ||
RUN steamcmd +quit | ||
|
||
# Fix missing directories and libraries | ||
RUN mkdir -p $HOME/.steam \ | ||
&& ln -s $HOME/.local/share/Steam/steamcmd/linux32 $HOME/.steam/sdk32 \ | ||
&& ln -s $HOME/.local/share/Steam/steamcmd/linux64 $HOME/.steam/sdk64 \ | ||
&& ln -s $HOME/.steam/sdk32/steamclient.so $HOME/.steam/sdk32/steamservice.so \ | ||
&& ln -s $HOME/.steam/sdk64/steamclient.so $HOME/.steam/sdk64/steamservice.so | ||
|
||
# Add entrypoint script | ||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
ENV VALHEIM_SERVER_NAME="Valheim Server" | ||
ENV VALHEIM_WORLD_NAME="Dedicated" | ||
ENV VALHEIM_SERVER_PORT=2456 | ||
|
||
# Set default command | ||
CMD ["/docker-entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -z "$VALHEIM_SERVER_PORT" ]; then | ||
echo "VALHEIM_SERVER_PORT must be set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$VALHEIM_SERVER_NAME" ]; then | ||
echo "VALHEIM_SERVER_NAME must be set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$VALHEIM_SERVER_PASSWORD" ]; then | ||
echo "VALHEIM_SERVER_PASSWORD must be set" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$VALHEIM_SERVER_PUBLIC" ]; then | ||
_IS_PUBLIC=1 | ||
else | ||
_IS_PUBLIC=0 | ||
fi | ||
|
||
|
||
if [ ! -f "/data/.installed" ]; then | ||
echo "Installing Valheim server..." | ||
/usr/bin/steamcmd +force_install_dir /data/valheim +login anonymous +app_update 896660 validate +exit | ||
touch /data/.initialized | ||
else | ||
echo "Updating Valheim server..." | ||
/usr/bin/steamcmd +force_install_dir /data/valheim +login anonymous +app_update 896660 +quit | ||
fi | ||
|
||
|
||
echo "Starting Valheim server..." | ||
|
||
cd /data/valheim | ||
|
||
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH | ||
export SteamAppId=892970 | ||
|
||
./valheim_server.x86_64 \ | ||
-name "$VALHEIM_SERVER_NAME" \ | ||
-port "$VALHEIM_SERVER_PORT" \ | ||
-world "$VALHEIM_WORLD_NAME" \ | ||
-password "$VALHEIM_SERVER_PASSWORD" \ | ||
-savedir "/data/saves" \ | ||
-public "${_IS_PUBLIC}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[image] | ||
registry = ghcr.io | ||
repository = tmacro/img | ||
platforms = linux/amd64, linux/arm64 |