diff --git a/README.md b/README.md index edfcb86..1602b8e 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ git clone https://ceregatti.org/git/daniel/dayzdockerserver.git cd dayzdockerserver ``` +Create a `.env` file that contains your user id. Usually the `${UID}` shell variable has this: + +```shell +echo "export USER_ID=${UID}" | tee .env +``` + Build the Docker images: ```shell diff --git a/docker-compose.yml b/docker-compose.yml index 34dee05..0f50439 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,11 @@ volumes: services: web: - build: web + build: + context: web + args: + - USER_ID + user: ${USER_ID} volumes: - homedir_main:/home/user - serverfiles:/serverfiles @@ -37,7 +41,11 @@ services: - .env server: - build: server + build: + context: server + args: + - USER_ID + user: ${USER_ID} volumes: - homedir_server:/home/user - serverfiles:/serverfiles diff --git a/server/Dockerfile b/server/Dockerfile index 19a4ca1..8a54ead 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -37,8 +37,10 @@ ENV PATH /files/bin:/server:${PATH} RUN cd /usr/local && git clone https://github.com/indepth666/py3rcon.git # Setup a non-privileged user -RUN groupadd user && \ - useradd -l -g user user && \ +ARG USER_ID + +RUN groupadd -g ${USER_ID} user && \ + useradd -l -u ${USER_ID} -m -g user user && \ mkdir -p /home/user /serverfiles/mpmissions /mods /mpmissions /profiles && \ chown -R user:user /home/user /serverfiles /mods /mpmissions /profiles diff --git a/web/Dockerfile b/web/Dockerfile index 805d774..682fb0c 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -61,11 +61,16 @@ ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH RUN cd /usr/local && git clone https://github.com/indepth666/py3rcon.git # Setup a non-privileged user -RUN groupadd user && \ - useradd -l -g user user && \ +ARG USER_ID + +RUN groupadd -g ${USER_ID} user && \ + useradd -l -u ${USER_ID} -m -g user user && \ mkdir -p /home/user /serverfiles/mpmissions /serverfiles/steamapps/workshop/content /web && \ chown -R user:user /home/user /serverfiles /web +# Shut steamcmd up +RUN cd /usr/lib/i386-linux-gnu && ln -s /web/bin/steamservice.so + # Add our startup script, as this rarely changes. COPY --chown=user:user start.sh /usr/local/bin/start.sh diff --git a/web/bin/steamservice.so b/web/bin/steamservice.so new file mode 100755 index 0000000..1bf3cbf Binary files /dev/null and b/web/bin/steamservice.so differ