diff options
-rw-r--r-- | Dockerfile | 54 | ||||
-rw-r--r-- | LICENSE.txt | 21 | ||||
-rw-r--r-- | README.md | 44 | ||||
-rw-r--r-- | docker-compose.yml | 17 | ||||
-rw-r--r-- | entrypoint.sh | 33 | ||||
-rw-r--r-- | neosvr.conf.json | 17 |
6 files changed, 186 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bdc600d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM ubuntu:18.04 + +# Id of the user (buildtime) +ARG UID +ENV UID ${UID:-1000} +# Id of the user's group (buildtime) +ARG GID +ENV GID ${GROUP:-1000} +# Ids of the apps steamcmd will install. Ex 4020,232330 +ARG INSTALL_APPS +ENV INSTALL_APPS ${INSTALL_APPS:-"740250"} +# Id of the app who will be launched +ARG LAUNCH_APP +ENV LAUNCH_APP ${LAUNCH_APP:-"740250"} + +# Steam credentials +ENV LOGIN ${LOGIN:-"anonymous"} +ENV PASSWORD ${PASSWORD:-""} +# Beta keys +ENV BETA_NAME ${BETA_NAME:-"headless-client"} +ENV BETA_KEY ${BETA_KEY:-""} + +RUN echo steam steam/question select "I AGREE" | debconf-set-selections && \ + echo steam steam/license note '' | debconf-set-selections + +ARG DEBIAN_FRONTEND=noninteractive + +RUN dpkg --add-architecture i386 && \ + apt-get update -y && \ + apt-get install -y --no-install-recommends ca-certificates locales steamcmd lib32tinfo5 tmux && \ + apt-get install -y gpg && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF &&\ + echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt-get update -y && \ + apt-get install -y --no-install-recommends mono-complete && \ + rm -rf /var/lib/apt/lists/* + +RUN locale-gen en_US.UTF-8 +ENV LANG 'en_US.UTF-8' +ENV LANGUAGE 'en_US:en' + +RUN ln -s /usr/games/steamcmd /usr/bin/steamcmd + +ADD entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh + +RUN mkdir /steam + +RUN steamcmd +quit + +ARG DEBIAN_FRONTEND= + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..4c7022d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Flavien CADET, brodokk + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a24bc8 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# NeosVR docker + +Based on a work from https://github.com/shiipou/steamcmd but simplified for +only work with NeosVR since I use this mainly for testing the headless client. + +Since I don't use this Dockerfile in production I don't recommend you to use +it as is for other thing than testing. + +# Usage + +You need to be logged as an user to be able to download NeosVR headless client. +For that set `LOGIN` and `PASSWORD` environment variables. + +You also need the beta key who can be set via the `BETA-KEY` environment +variable. + +Before using it you need to build it and then use it, for example, directly +via docker with the following commands. Keep in mind this took some time, so be +patient. + +``` +docker build -t neosvr_headless . +docker run -it -v "steam:/steam" -v "neosvr.conf.json:/steam/740250/Config/Config.json" -e BETA_NAME=headless-client -e BETA_KEY=**** -e LOGIN=user -e PASSWORD=pwd neosvr_headless +``` + +Tips: if you have some problems you can launch a bash (or everything who start +by `/`) to the docker run command. + +If needed you can also overwrite the `INSTALL_APPS` and `LAUNCH_APP` +environement variables. The first one is usefull if you need to install more +apps than one (this is a string where apps ids are separated by `,` without +spaces) but not needed actually for the NeosVR headless client. And the second +environement variable is for define the app to be launched at start. Both have +as default value the actual NeosVR headless client id `740250`. + +You can also launch it via docker-compose with the example file +`docker-compose.yml` provided. + +After the container is started, you just need attach to it with the following +command if you want to control the server. + +``` +docker attach <container_name> +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..95fd75c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3.7" + +services: + neosvr: + build: . + environment: + LAUNCH_APP: 740250 + INSTALL_APPS: 740250 + LOGIN: user + PASSWORD: pwd + BETA_NAME: headless-client + BETA_KEY: *** + volumes: + - ./steam:/steam + - ./neosvr.conf.json:/steam/740250/Config/Config.json + stdin_open: true + tty: true diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..713d82d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +if [ -n "${INSTALL_APPS}" ]; then + OLD_IFS=$IFS + IFS=',' + for app in ${INSTALL_APPS}; do + steamcmd_binary="steamcmd" + password_bypass="" + beta_cmd="" + if [ -n "${BETA_NAME}" ]; then + beta_cmd=" -beta ${BETA_NAME}" + if [ -n "${BETA_KEY}" ]; then + beta_cmd="${beta_cmd} -betapassword ${BETA_KEY}" + fi + fi + if [ -n "${PASSWORD}" ]; then + password_bypass="echo '${PASSWORD}' | " + fi + echo "Check if ${app} is up to date" + /bin/sh -c "${steamcmd_binary} +login ${LOGIN} ${PASSWORD} +force_install_dir /steam/${app} +app_update ${app}${beta_cmd} validate +quit" + done + IFS=$OLD_IFS +fi + +arguments=$@ +case "$arguments" in + "/"*) + echo "Run custom commands : ${arguments}" + /bin/sh -c "$arguments";; + *) + echo "Run NeosVR headless client" + cd /steam/${LAUNCH_APP}/ && mono Neos.exe;; +esac diff --git a/neosvr.conf.json b/neosvr.conf.json new file mode 100644 index 0000000..20accdb --- /dev/null +++ b/neosvr.conf.json @@ -0,0 +1,17 @@ +{ + "tickRate": 60.0, + "usernameOverride": "Headless docker", + "loginCredential": null, + "loginPassword": null, + "startWorld": { + "sessionName": "Testing", + "description": "Headless with docker", + "maxUsers": 16, + "accessLevel": "Anyone", + "tags": "hosted", + "mobileFriendly": false, + "loadWorldURL": null, + "loadWorldPresetName": "GridSpace", + "adminUsernames": [] + } +} |