Builder Image
The Builder Image is responsible for compiling the emulator server. It includes the source code and scripts required to run the entire build process—from compiling the source code to producing the final binary artifacts. With the Builder Image, you can build your own variants from the source.
What is: Compilation (Compiling)
Imagine you wrote a recipe for a cake in a language only bakers understand, but your robot chef can't read it. Compilation is like translating your recipe into simple step-by-step instructions that the robot can follow and make the exact cake.
flowchart TD
A[Build Deps Image] --> B[Builder Image]
B -->|Build Artifacts| D[Release Image]
C[Runtime Image] -->|Runtime Dependencies| D
classDef highlighted stroke-width:2px;
classDef faded fill-opacity:0.2,stroke:#000,stroke-width:1px;
class A faded;
class B highlighted;
class C faded;
class D faded;
What is the Builder Image?
The Builder Image:
- Runs the Build Process: Executes all steps required to compile the emulator server.
- Includes a Specific Source Version: The source code is pre-baked into the image.
- Relies on Build Deps: Uses fixed dependencies from the Build Deps image to maintain a stable build environment.
- Supports Customization: You can set environment variables or pass additional arguments when running the image with
docker run
to adjust the build process as needed.
Running the Builder Image
ThoriumLXC offers container images for various emulator server projects, each accompanied by its own set of instructions for leveraging the build process. All of these images follow the same general pattern, which can be summarized as a docker run
command.
This looks like the following:
docker run --name thoriumlxc-build -v "outputs":/opt/outputs thoriumlxc/placeholder-image-name
Tip
This is a mock-example of a docker run
command that will not work. Refer to the emulator server projects "Building ..." pages for runnable steps.
This command can be explained as:
docker run
- Starts a new container (an isolated environment) from an image.--name thoriumlxc-build
- Gives the container the name "thoriumlxc-build" for easier reference.-v "outputs":/opt/outputs
- Links a local folder called "outputs" to the container’s /opt/outputs folder so you can share files between your computer and the container.thoriumlxc/placeholder-image-name
- Specifies which Docker image to use as the blueprint for the container’s software and settings. This is a mock image.
When the build process completes, the compiled artifacts are placed in an output directory inside the container called /opt/outputs
. Since this directory is set up to share files between your computer and the container, the files automatically appear in the outputs
folder, looking something like this:
.
├── bin
│ ├── mangosd
│ ├── realmd
│ ├── run-mangosd
│ ├── run-realmd
│ ├── tools
│ │ ├── ad
│ │ ├── ExtractResources.sh
│ │ ├── MoveMapGen
│ │ ├── MoveMapGen.sh
│ │ ├── offmesh.txt
│ │ ├── vmap_assembler
│ │ └── vmap_extractor
│ └── warden_modules
├── etc
│ ├── ahbot.conf
│ ├── aiplayerbot.conf
│ ├── anticheat.conf
│ ├── anticheat.conf.dist
│ ├── mangosd.conf
│ ├── mangosd.conf.dist
│ ├── realmd.conf
│ └── realmd.conf.dist
└── run
Hermetic Builds Explained
The Builder Image includes mechanisms to attempt to produce hermetic builds. But what does "hermetic" mean in this context?
It means that slight modifications have been made to the build processes of the upstream emulator server projects, and measures have been taken to control external factors that could influence the build.
In simple terms:
- The timestamp for the build artifacts is set to a fixed date.
- The operating system, libraries, tools, and system packages are fixed versions.
- The emulator server project source code is fixed to a specific version.
- The emulator server build process has been modified to rely on fixed versions.
These measures should ensure that multiple runs of the Builder Image, with the exact same arguments, yield bit-wise identical binaries.
Summary
- The Builder Image handles the full build process for the emulator server.
- It uses pre-baked source code
- It uses fixed dependencies from the Build Deps image.
- You can customize builds with environment variables or arguments via
docker run
. - Hermetic builds ensure that every build is consistent and reproducible, no matter where or when it's run.