Skip to content

Dockerfile builder

Faber runs whatever toolchains its image contains. Tick the languages you serve and copy the result: a Dockerfile on top of vgfractal/faber:base (Faber without compilers) that installs only those toolchains, adds the paths they need to SANDBOX_READONLY_PATHS, and records them in FABER_TOOLCHAINS so GET /info can report them. The page keeps your choice in its URL, so you can share or bookmark it.

1. Languages

Compiled languages
JVM
.NET
JavaScript and TypeScript
Scripting languages
Functional languages

2. Options

Dockerfile

# Faber with C 12.
# Generated from docker/toolchains/catalog.json by the Faber Dockerfile builder.

FROM vgfractal/faber:base

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        gcc \
        libc6-dev \
        make \
    && rm -rf /var/lib/apt/lists/*

ENV SANDBOX_READONLY_PATHS=/bin,/lib,/lib64,/usr,/etc/alternatives,/etc/ld.so.cache,/etc/passwd,/etc/group \
    FABER_TOOLCHAINS=c@12

# Identifies this build in the step cache. Pass a new value on every build:
#   docker build --build-arg FABER_IMAGE_ID="$(date -u +%Y%m%dT%H%M%SZ)" .
ARG FABER_IMAGE_ID=
ENV FABER_IMAGE_ID=${FABER_IMAGE_ID}

Build and run

Language Size Memory PIDs Compile Run Task env

  1. Build it with the command above, in a directory that holds only the Dockerfile.
  2. Test every language under the default sandbox profile before relying on it. Start the image (privileged, as above) and run API_URL=http://localhost:3000/api/v1 API_KEY=... scripts/toolchain-test.sh from a checkout of the repository; it runs each language’s example program and checks its output. On a development machine, run it inside the disposable VM with scripts/vm.sh test-toolchains instead.
  3. Set FABER_IMAGE_ID to the image digest or your build ID when the step cache is enabled, so a rebuilt image never replays layers produced by different toolchains.
  4. Pin the base tag to a release in production instead of base, which moves with every push to main.
  • Profiles. The table lists the profile to compile with and the one to run with. Languages whose programs start threads (Go, the JVM, Node.js) run under compile_v2; single-threaded native programs can run under the stricter native_v2. See sandbox profiles.
  • Task environment. Tasks do not inherit the image’s ENV. Some toolchains need a writable home or cache directory; send the variables in the “Task env” column in each task’s env.
  • Limits. MEMORY_MAX and PIDS_MAX apply to every task of an instance. If one language needs more, every task gets more, and the instance needs more memory per task slot. Serving a heavy runtime and many light ones? Consider separate instances.

Write the Dockerfile by hand on top of the builder’s output: install the toolchain under a path tasks can see, link its commands into /usr/local/bin (the sandbox’s PATH does not include the image’s), add any other path it reads to SANDBOX_READONLY_PATHS, and test it as above. Docker deployment lists the rules.