diff --git a/Dockerfile b/Dockerfile index a3561ec..e3f5804 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,26 +3,26 @@ FROM alpine as downloader WORKDIR /download -ENV VSTYPE stable -ENV VSVERSION 1.13.0 +ARG vs_type=stable +ARG vs_version=1.13.0 -RUN wget "https://cdn.vintagestory.at/gamefiles/${VSTYPE}/vs_server_${VSVERSION}.tar.gz" -RUN tar xzf "vs_server_${VSVERSION}.tar.gz" -RUN rm "vs_server_${VSVERSION}.tar.gz" +RUN wget "https://cdn.vintagestory.at/gamefiles/${vs_type}/vs_server_${vs_version}.tar.gz" +RUN tar xzf "vs_server_${vs_version}.tar.gz" +RUN rm "vs_server_${vs_version}.tar.gz" # ============== runtime stage ================== FROM mono:latest as runtime WORKDIR /game -ENV VSDATAPATH vs +ARG vs_data_path=/gamedata/vs COPY --from=downloader "./download/" "/game" -COPY "./serverconfig.json" "/gamedata/${VSDATAPATH}/serverconfig.json" +COPY "./serverconfig.json" "${vs_data_path}/serverconfig.json" # Expose ports EXPOSE 42420/tcp -# CMD [ "mono" , "VintagestoryServer.exe", "--dataPath", "/gamedata/${VSDATAPATH}" ] -CMD mono VintagestoryServer.exe --dataPath "/gamedata/${VSDATAPATH}" +# Execution command +CMD mono VintagestoryServer.exe --dataPath ${vs_data_path} diff --git a/README.md b/README.md index feb7801..2c55c43 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,18 @@ You can either copy files from `https://github.com/Devidian/docker-vintagestory/ # ============== runtime stage ================== FROM devidian/vintagestory:latest as runtime -WORKDIR /game +ARG vs_data_path=/gamedata/vs # update with your own serverconfig -COPY "./serverconfig.json" "/gamedata/${VSDATAPATH}/serverconfig.json" +COPY serverconfig.json ${vs_data_path}/serverconfig.json +# copy mods +#COPY Mods ${vs_data_path}/Mods/ +# copy default player data +#COPY Playerdata ${vs_data_path}/Playerdata/ -# CMD [ "mono" , "VintagestoryServer.exe", "--dataPath", "/gamedata/${VSDATAPATH}" ] -CMD mono VintagestoryServer.exe --dataPath "/gamedata/${VSDATAPATH}" +WORKDIR /game + +CMD mono VintagestoryServer.exe --dataPath ${vs_data_path} ``` @@ -34,15 +39,17 @@ version: '3.1' services: vsserver: - build: . + build: + context: . + args: + vs_data_path: /gamedata/vs-mods/ container_name: vsserver restart: always volumes: - gamedata:/gamedata ports: - 42420:42420 - environment: - VSDATAPATH: vs-custom + volumes: gamedata: ``` diff --git a/build-custom-example/Dockerfile b/build-custom-example/Dockerfile index 46fe4cc..54e2788 100644 --- a/build-custom-example/Dockerfile +++ b/build-custom-example/Dockerfile @@ -1,10 +1,15 @@ # ============== runtime stage ================== FROM devidian/vintagestory:latest as runtime -WORKDIR /game +ARG vs_data_path=/gamedata/vs # update with your own serverconfig -COPY "./serverconfig.json" "/gamedata/${VSDATAPATH}/serverconfig.json" +COPY serverconfig.json ${vs_data_path}/serverconfig.json +# copy mods +COPY Mods ${vs_data_path}/Mods/ +# copy default player data +COPY Playerdata ${vs_data_path}/Playerdata/ -# CMD [ "mono" , "VintagestoryServer.exe", "--dataPath", "/gamedata/${VSDATAPATH}" ] -CMD mono VintagestoryServer.exe --dataPath "/gamedata/${VSDATAPATH}" +WORKDIR /game + +CMD mono VintagestoryServer.exe --dataPath ${vs_data_path} diff --git a/build-custom-example/Mods/ExtendedChiselDurability.zip b/build-custom-example/Mods/ExtendedChiselDurability.zip new file mode 100644 index 0000000..829c164 Binary files /dev/null and b/build-custom-example/Mods/ExtendedChiselDurability.zip differ diff --git a/build-custom-example/Playerdata/playerdata.json b/build-custom-example/Playerdata/playerdata.json new file mode 100644 index 0000000..31b2de9 --- /dev/null +++ b/build-custom-example/Playerdata/playerdata.json @@ -0,0 +1,14 @@ +[ + { + "PlayerUID": "Mo9k7zpajYd5tnelISSR6BDl", + "RoleCode": "admin", + "PermaPrivileges": [], + "DeniedPrivileges": [], + "PlayerGroupMemberShips": {}, + "AllowInvite": true, + "LastKnownPlayername": "Devidian", + "CustomPlayerData": {}, + "ExtraLandClaimAllowance": 0, + "ExtraLandClaimAreas": 0 + } +] \ No newline at end of file diff --git a/build-custom-example/Playerdata/playergroups.json b/build-custom-example/Playerdata/playergroups.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/build-custom-example/Playerdata/playergroups.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/build-custom-example/Playerdata/playersbanned.json b/build-custom-example/Playerdata/playersbanned.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/build-custom-example/Playerdata/playersbanned.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/build-custom-example/Playerdata/playerswhitelisted.json b/build-custom-example/Playerdata/playerswhitelisted.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/build-custom-example/Playerdata/playerswhitelisted.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/build-custom-example/docker-compose.yml b/build-custom-example/docker-compose.yml index e1d9378..eeefcbc 100644 --- a/build-custom-example/docker-compose.yml +++ b/build-custom-example/docker-compose.yml @@ -2,14 +2,16 @@ version: '3.1' services: vsserver: - build: . + build: + context: . + args: + vs_data_path: /gamedata/vs-mods/ container_name: vsserver restart: always volumes: - gamedata:/gamedata ports: - 42420:42420 - environment: - VSDATAPATH: vs-custom + volumes: gamedata: \ No newline at end of file