diff --git a/Dockerfile b/Dockerfile index 40f487d..846d768 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,7 @@ RUN rm -rf /home/minetest/minetest-source/ USER minetest WORKDIR /usr/local/share/minetest +RUN mkdir -p worlds EXPOSE 30000/udp ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a5c2ab0..e49b91b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,16 +3,16 @@ services: environment: - SERVER_GAME - SERVER_ADMIN + - WORLD_NAME build: context: . restart: always network_mode: host volumes: - # - type: bind - # source: ./data/.env - # target: /usr/local/share/minetest.env - ${PWD}/sample.env:/usr/local/share/minetest/.env - ${PWD}/data/games:/usr/local/share/minetest/games + - ${PWD}/data/worlds:/usr/local/share/minetest/worlds + ports: - "30000:30000/udp" - "127.0.0.1:30000:30000/tcp" diff --git a/entrypoint.sh b/entrypoint.sh index 3e91bf8..20faf53 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,4 +9,6 @@ echo $SERVER_ADMIN #Set up admin name echo "name = ${SERVER_ADMIN}" > /usr/local/share/minetest/minetest.conf -/usr/local/bin/minetestserver --gameid $gameid --config /usr/local/share/minetest/minetest.conf \ No newline at end of file +/usr/local/bin/minetestserver --gameid $gameid \ + --config /usr/local/share/minetest/minetest.conf \ + --world /usr/local/share/minetest/worlds/${WORLD_NAME} \ No newline at end of file diff --git a/install.sh b/install.sh index 5a15f5c..bc55eb5 100755 --- a/install.sh +++ b/install.sh @@ -7,7 +7,7 @@ download_and_install_game() { download_url=$(curl -X GET --silent "$API_URL/packages/${1}/" | jq ".url" | tr -d '"') cd games || exit wget -O game.zip "${download_url}" - unzip -foqq game.zip + unzip -foq game.zip rm game.zip cd ../ # data } @@ -18,8 +18,8 @@ cd data || exit calculated_dependencies=() #Checking for input -if [[ $SERVER_MODS == "" || $SERVER_GAME == "" ]]; then - echo "Please, fill server.env file before launching this script!" +if [[ $SERVER_MODS == "" || $SERVER_GAME == "" || $WORLD_NAME == "" ]]; then + echo "Please, fill .env file before launching this script!" exit 1 fi @@ -57,7 +57,7 @@ download_and_install_mod () { mod_file="${mods_path}/mod.zip" echo "Writing to ${mod_file} content from url ${mod_url}" wget -O "${mod_file}" "${mod_url}" - unzip -foqq "${mod_file}" -d "${mods_path}" + unzip -foq "${mod_file}" -d "${mods_path}" rm "${mod_file}" }