mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 14:21:18 +00:00
Use the local user's user id in the container when building and running, otherwise bind mounts don't have the correct ownership.
Correct output from steamcmd to avoid red herrings by creating a directory it expects as well as providing a shared object it also expects. Update docs.
This commit is contained in:
parent
4d546241ad
commit
f153f3db18
5 changed files with 27 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
BIN
web/bin/steamservice.so
Executable file
BIN
web/bin/steamservice.so
Executable file
Binary file not shown.
Loading…
Add table
Reference in a new issue