### ### Build Variables ### FROM localhost/debian:latest # deploy options # -p (port) and -v (volume) both go host:container LABEL config_default="\ -p 2456-2458:2456-2458 \ -p 2456-2458:2456-2458/udp \ -v /srv/vol/valheim/data:/vol/data" # Build variables # uid that the files owner user should have ARG FILESUID=5000 ### ### General Setup ### # install basic packages RUN apt update -y && apt install -y libsdl2-2.0-0 zip # install steamcmd RUN apt-add-repository contrib && \ apt-add-repository non-free && \ dpkg --add-architecture i386 && \ apt update -y && \ echo steam steam/question select "I AGREE" | debconf-set-selections && \ echo steam steam/license note '' | debconf-set-selections && \ apt install -y steamcmd # create valheim server user with file owner UID RUN addgroup --gid $FILESUID vhadmin && \ adduser vhadmin --ingroup vhadmin --uid $FILESUID --disabled-password --gecos "Valheim Server Admin" --shell /usr/sbin/nologin # Copy custom scripts COPY assets/bin/ /usr/local/bin/ ### ### Valheim ### WORKDIR /home/vhadmin # install Valheim RUN vh-install # replace permissions txt's with links RUN mkdir -p .config/unity3d/IronGate/Valheim/worlds_local; \ ln -s .config/unity3d/IronGate/Valheim/worlds_local worlds; \ cd .config/unity3d/IronGate/Valheim/; \ for f in adminlist.txt bannedlist.txt permittedlist.txt; \ do rm -f $f; ln -s /vol/data/config/$f; \ done; \ chown -R vhadmin:vhadmin /home/vhadmin # copy units to systemd COPY assets/systemd/ /etc/systemd/system/ # enable systemd units RUN systemctl enable valheim.service vh-backup.timer vh-install.service