Class ServerPackageDockerfile

Namespace
Unity.Multiplayer.Core

The Dockerfile and .dockerignore for a server package, for profiles that run it as a container. The image runs start.sh as a non-root user, exposes the declared ports, keeps Saves/ and Logs/ in volumes, stops with SIGTERM and probes the health endpoint.

public static class ServerPackageDockerfile
Inheritance
ServerPackageDockerfile
Inherited Members

Fields

DefaultBaseImage

The base image used unless the profile names another.

public const string DefaultBaseImage = "ubuntu:24.04"

Field Value

string

FileName

The Dockerfile's name.

public const string FileName = "Dockerfile"

Field Value

string

IgnoreFileName

The .dockerignore's name.

public const string IgnoreFileName = ".dockerignore"

Field Value

string

User

The non-root user the server runs as.

public const string User = "server"

Field Value

string

WorkDir

The package folder inside the image.

public const string WorkDir = "/srv/game"

Field Value

string

Methods

Compose(ServerPackageSpec, string)

The Dockerfile text for spec.

public static string Compose(ServerPackageSpec spec, string baseImage = null)

Parameters

spec ServerPackageSpec
baseImage string

Returns

string

Exceptions

ArgumentNullException

spec is null.

ComposeIgnore(ServerPackageSpec, IEnumerable<string>)

The .dockerignore: Unity's debug-symbol and backup folders, which must not ship, local logs and saves, which must not be baked into the image, and the Docker files themselves.

public static string ComposeIgnore(ServerPackageSpec spec, IEnumerable<string> alsoIgnore = null)

Parameters

spec ServerPackageSpec
alsoIgnore IEnumerable<string>

Returns

string

Exceptions

ArgumentNullException

spec is null.

ContainerPath(string)

A package folder's path inside the container: absolute paths as given, relative ones under WorkDir.

public static string ContainerPath(string directory)

Parameters

directory string

Returns

string