commit 6143880ff3849bd13c7332322dafd7ce79eefa01 Author: Joel Maxwell Date: Mon Jun 8 12:35:42 2026 -0300 Initial Valheim dedicated server container with web UI scaffold diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3f8762e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM debian:12-slim + +ENV DEBIAN_FRONTEND=noninteractive +ENV VALHEIM_SERVER_DIR=/opt/valheim +ENV STEAMCMD_DIR=/opt/steamcmd +ENV USER=valheim + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + wget \ + jq \ + lib32gcc-s1 \ + tini \ + procps \ + iproute2 && \ + rm -rf /var/lib/apt/lists/* + +# Create user +RUN useradd -m -d /home/${USER} -s /bin/bash ${USER} + +# Create directories +RUN mkdir -p ${VALHEIM_SERVER_DIR} ${STEAMCMD_DIR} +RUN chown -R ${USER}:${USER} /opt /home/${USER} + +USER ${USER} + +# Install SteamCMD +RUN cd ${STEAMCMD_DIR} && \ + wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz && \ + tar -xvzf steamcmd_linux.tar.gz && \ + rm steamcmd_linux.tar.gz + +# Copy entrypoint +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +EXPOSE 2456/udp 2457/udp 2458/udp +EXPOSE 8080 + +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["/entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4c31d2f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.9" + +services: + valheim: + build: . + container_name: valheim + restart: unless-stopped + environment: + SERVER_NAME: "${SERVER_NAME}" + WORLD_NAME: "${WORLD_NAME}" + SERVER_PASSWORD: "${SERVER_PASSWORD}" + ports: + - "2456:2456/udp" + - "2457:2457/udp" + - "2458:2458/udp" + - "8080:8080" + volumes: + - valheim_data:/opt/valheim + - valheim_config:/home/valheim/.config/unity3d/IronGate/Valheim + networks: + - valheim_net + +volumes: + valheim_data: + valheim_config: + +networks: + valheim_net: + driver: bridge diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..51bf433 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +VALHEIM_SERVER_DIR=${VALHEIM_SERVER_DIR:-/opt/valheim} +STEAMCMD_DIR=${STEAMCMD_DIR:-/opt/steamcmd} + +echo "=== Updating Valheim Dedicated Server via SteamCMD ===" +${STEAMCMD_DIR}/steamcmd.sh +login anonymous \ + +force_install_dir ${VALHEIM_SERVER_DIR} \ + +app_update 896660 validate \ + +quit + +echo "=== Starting Web Management Interface ===" +# Placeholder — you will replace with your actual web UI +python3 /opt/webui/server.py & + +echo "=== Starting Valheim Server ===" +cd ${VALHEIM_SERVER_DIR} + +./valheim_server.x86_64 \ + -name "${SERVER_NAME}" \ + -port 2456 \ + -world "${WORLD_NAME}" \ + -password "${SERVER_PASSWORD}" \ + -public 1 diff --git a/webui/server.py b/webui/server.py new file mode 100644 index 0000000..e69de29