Jump to content

Building from source

From Wikven

Most people never need this page. Installation offers a prebuilt binary and a prebuilt image, and either is a shorter road to a built site than this one. Build from source to run a change of your own, or a commit that no release carries yet.

To run an unreleased commit without building anything, there are nightly builds: a dated nightly-YYYY-MM-DD image tag, and a nightly release of the binary.

Docker builds both products, the binary included -- the static PHP it embeds is compiled inside a container -- so the host needs only git and Docker.

The image

Clone the repository and build it:

git clone https://github.com/chaotic-ground/wikven.git
cd wikven
docker build -t wikven .

That leaves a local wikven image, which you run exactly as Getting Started runs the published one: only the name differs.

The binary

The standalone binary embeds the image's own tree, so build the image first, out of the same checkout. Then:

docker build -f binary.Dockerfile --target export -o type=local,dest=out .

out/wikven is the executable. --target export stops at the last stage of binary.Dockerfile, which holds the compiled binary and nothing else, and -o writes that stage to a directory instead of loading it as an image.

Expect it to take far longer than the image did: it compiles a static PHP from source and links FrankenPHP around the embedded tree. The workflow that builds the released binaries allows the step an hour.

What comes out is built for the architecture you built it on, and runs from wherever you put it:

WIKVEN_WORKDIR=. ./out/wikven build

Standalone binary covers installing it onto your PATH, and the host programs it uses when they are there.

A GitHub rate limit

The static PHP build resolves the libraries it compiles through api.github.com, which answers an address that sends no token 60 times an hour -- shared, on a company network, with everyone behind it. A build that stops there wants a token, which the GitHub CLI will print for an account you are already signed in to:

GITHUB_TOKEN=$(gh auth token) docker build -f binary.Dockerfile --target export \
  --secret id=github-token,env=GITHUB_TOKEN -o type=local,dest=out .

It is passed as a build secret, so no layer of the image records it.


To work on Wikven itself rather than only build it, Development describes what the pieces are and what the build does with them.