Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pull_request_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Docker Image CI

on:
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build the Docker image
run: docker build . --file Dockerfile --tag fuzzystatic/nitrox-server:latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
config/
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Here are some example snippets to help you get started creating a container.

To run the image using docker-compose, adjust this docker-compose file to your needs:

```docker
```yaml
version: "1.0"
services:
nitrox:
image: docker.io/fuzzystatic/nitrox-server:latest
image: fuzzystatic/nitrox-server:latest
container_name: nitrox-server
volumes:
- "/path/to/nitrox:/config" # Stores your server data, such as the configuration and world data
Expand All @@ -23,8 +23,8 @@ services:
- "PUID=1000" # The ID of the group to run Nitrox as (default=1000)
- "PGID=1000" # The ID of the user to run Nitrox as (default=1000)
- "TZ=Etc/UTC" # The timezone to run Nitrox with (default=Etc/UTC)
- "SUBNAUTICA_INSTALLATION_PATH=/subnautica" # The timezone to run Nitrox with (default=/subnautica)
- "SUBNAUTICA_SAVE=My World" # Set this to your desired save name (default=My World) (Optional)
- "SUBNAUTICA_INSTALLATION_PATH=/subnautica" # The path on the container where 'Subnautica_Data' directory is (default=/subnautica)
- "SUBNAUTICA_SAVE=My World" # Set this to your desired save name (default=My World)
- "CUSTOM_NITROX_REPOSITORY=SubnauticaNitrox/Nitrox" # Set this to the fork you want to use (default=SubnauticaNitrox/Nitrox)
ports:
- "11000:11000/udp" # Nitrox
Expand All @@ -51,15 +51,15 @@ docker run -d \

Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container.

| Parameter | Function |
| :----: | --- |
| `-p 11000/udp` | server port - port forwarding may be required to host on the internet. |
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
| `-e SUBNAUTICA_INSTALLATION_PATH=/subnautica` | Subnautica game data. |
| `-v /config` | Nitrox server data storage location. |
| `-v /subnautica` | Subnautica game data goes here. |
| Parameter | Function |
|:---------------------------------------------:|----------------------------------------------------------------------------------------------------------------|
| `-p 11000/udp` | server port - port forwarding may be required to host on the internet. |
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
| `-e SUBNAUTICA_INSTALLATION_PATH=/subnautica` | Subnautica game data (on the container). |
| `-v /config` | Nitrox server data storage location. |
| `-v /subnautica` | Subnautica game data goes here. |

## User / Group Identifiers

Expand Down
8 changes: 4 additions & 4 deletions install-nitrox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
echo "Downloading latest Nitrox release..."
mkdir --parents /config/packages
cd /config/packages
curl --silent https://api.github.com/repos/${CUSTOM_NITROX_REPOSITORY:-"SubnauticaNitrox/Nitrox"}/releases/latest \
curl --silent https://api.github.com/repos/"${CUSTOM_NITROX_REPOSITORY:-"SubnauticaNitrox/Nitrox"}"/releases/latest \
| grep -wo "https.*linux_x64.zip" \
| wget --output-document ./nitrox.zip --quiet --input-file -

Expand All @@ -15,11 +15,11 @@ unzip -u /config/packages/nitrox.zip -d ./

# Fix the permissions
echo "Fixing Nitrox permissions..."
chmod +x ./*.exe
chmod +x Nitrox.Launcher Nitrox.Server.Subnautica # *.exe did nothing because this is linux

# Fix bug due to Linux file name case sensitivity
echo "Fixing Nitrox case sensitive filenames..."
ln --symbolic --force /subnautica/Subnautica_Data/Managed/LitJson.dll ./LitJSON.dll
ln --symbolic --force "${SUBNAUTICA_INSTALLATION_PATH:-"/subnautica"}"/Subnautica_Data/Managed/LitJson.dll ./LitJSON.dll

# Set the path to Subnautica
echo "/subnautica" > ./path.txt
echo "${SUBNAUTICA_INSTALLATION_PATH:-"/subnautica"}" > ./path.txt
8 changes: 4 additions & 4 deletions run-nitrox.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/sh

# Check if the game files are available
while true
do
echo "Looking for Subnautica's game files..."
if [ -d "/subnautica/Subnautica_Data" ]
if [ -d "${SUBNAUTICA_INSTALLATION_PATH:-"/subnautica"}/Subnautica_Data" ]
then
echo "Subnautica's game files were found at /subnautica"
echo "Subnautica's game files were found at ${SUBNAUTICA_INSTALLATION_PATH:-"/subnautica"}"
break
else
echo "Subnautica's game files could not be found, please make sure to mount your Subnautica game directory at /subnautica inside the container"
echo "Subnautica's game files could not be found, please make sure to mount your Subnautica game directory at ${SUBNAUTICA_INSTALLATION_PATH:-"/subnautica"} inside the container"
echo "Waiting 10 seconds before attempting again..."
sleep 10
fi
Expand Down
8 changes: 4 additions & 4 deletions setup-timezone.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh

# Configures the timezone
echo "Setting timezone to ${TZ}..."
ln --symbolic --no-dereference --force /usr/share/zoneinfo/${TZ} /etc/localtime
echo ${TZ} > /etc/timezone
echo "Setting timezone to ${TZL:-"Etc/UTC"}..."
ln --symbolic --no-dereference --force /usr/share/zoneinfo/"${TZ:-"Etc/UTC"}" /etc/localtime
echo "${TZ:-"Etc/UTC"}" > /etc/timezone
14 changes: 7 additions & 7 deletions setup-user.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
#!/bin/sh

# Remove existing user
echo "Removing existing user..."
userdel nitrox || true
groupdel nitrox || true
userdel nitrox >/dev/null 2>&1 || true # Actually makes the errors quiet
groupdel nitrox >/dev/null 2>&1 || true

# Create the user group
echo "Creating Nitrox user group with ID ${PGID}..."
groupadd --gid ${PGID} nitrox
echo "Creating Nitrox user group with ID ${PGID:-1000}..."
groupadd --gid "${PGID:-1000}" nitrox

# Create the user
echo "Creating Nitrox user account with ID ${PUID}..."
useradd --gid ${PGID} --uid ${PUID} --home-dir /config nitrox
echo "Creating Nitrox user account with ID ${PUID:-1000}..."
useradd --gid "${PGID:-1000}" --uid "${PUID:-1000}" --home-dir /config nitrox

# Change the active user
echo "Switching to Nitrox user..."
Expand Down
Loading