diff --git a/Containerfile b/Containerfile index 2d0dff7..e697da5 100644 --- a/Containerfile +++ b/Containerfile @@ -7,7 +7,6 @@ ENV USER_HOME "/home/ubuntu" ENV STEAMCMD "$USER_HOME/steamcmd/steamcmd.sh" ENV SERVER_DIR "/data" ENV SERVER_CONFIG_DIR "/config" -ENV SERVER_CONFIG_FILE "$SERVER_CONFIG_DIR/server.json" # Use default non root user ubuntu (1000) WORKDIR $USER_HOME diff --git a/README.md b/README.md new file mode 100644 index 0000000..1777226 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Sons of the Forest dedicated server container image + diff --git a/test-image.sh b/test-image.sh index 30fb498..aa94c5d 100755 --- a/test-image.sh +++ b/test-image.sh @@ -1,26 +1,30 @@ #!/usr/bin/env bash +# Create config and data directories, ignore errors if they already exist +mkdir -p ./config ./data 2> /dev/null + # Spin up a new container echo "๐Ÿš€ Spinning up a test container" -docker run -d --name test-container rouhim/sons-of-the-forest +docker-compose up -d # Wait some time echo "๐Ÿ˜ด sleeping 10 minutes" sleep 10m -# Test for "[Self-Tests] Please restart the server" +# Test for the string "Please restart the server" is in the server log +# If it is, then the server started successfully +# If it is not, then the server failed to start echo "๐Ÿงช Testing for success" -docker logs test-container | grep -i '\[Self-Tests\] Please restart the server' -if [ "$?" -eq 0 ]; then - echo "โŒ Found errors in server log:" - echo "======================" - docker logs test-container - echo "======================" - docker kill test-container && docker rm test-container +if docker-compose logs | grep -q "Please restart the server"; then + echo "โœ… Server started successfully" +else + echo "โŒ Server failed to start" + docker-compose logs + docker-compose kill && docker-compose down --volumes exit 1 fi # Cleanup and exit with 0 -docker kill test-container && docker rm test-container +docker-compose kill && docker-compose down --volumes echo "โœ… Done, everything looks good" exit 0