AkurAI Build
Menu

AkurAI-Build

public

Latest change 604d085a4c479b8883db5803e65212cfee659f6e - Fix run deep links and bound deploy context (AKURAI-BUILD-5) by Ólafur Búi Ólafsson

# AkurAI Build container images: one build stage, two runtime targets.
#
#   docker build --target service -t akurai-build-service:<ver> -f deploy/Dockerfile .
#   docker build --target worker  -t akurai-build-worker:<ver>  -f deploy/Dockerfile .
#
# service — HTTP API, dashboard, hosted git (AKURAI_WORKERS=0, no execution).
# worker  — run executor (AKURAI_WORKERS>=1). Native jobs use the HOST rustup
#           and cargo trees bind-mounted at the same paths as on Titan, so
#           per-repo .akurai.yml env prefixes keep working unchanged. Docker
#           executor jobs are spawned as SIBLING containers via the mounted
#           /var/run/docker.sock.

FROM debian:stable-slim AS service-base
RUN apt-get update \
    && apt-get install -y --no-install-recommends git ca-certificates curl \
    && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/local/bin/akurai"]

# Keep this target before the source build: the legacy Docker builder executes
# every preceding stage even when --target is set.
FROM service-base AS service-prebuilt
COPY target/release/akurai /usr/local/bin/akurai

FROM rust:1.97 AS build
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY migrations ./migrations
COPY app ./app
COPY public ./public
COPY akurai.example.yml ./
RUN cargo build --release --locked

FROM service-base AS service
COPY --from=build /src/target/release/akurai /usr/local/bin/akurai

FROM debian:stable-slim AS worker
ARG DOCKER_CLI_VERSION=27.5.1
ARG BUN_VERSION=1.3.14
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        git ca-certificates curl openssh-client rsync python3 procps jq unzip \
        build-essential musl-tools pkg-config \
        cmake ninja-build \
        qt6-base-dev qt6-declarative-dev qt6-websockets-dev libmpvqt-dev \
    && curl -fsSL "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip" -o /tmp/bun.zip \
    && unzip -q /tmp/bun.zip -d /tmp/bun \
    && install -m 755 /tmp/bun/bun-linux-x64/bun /usr/bin/bun \
    && rm -rf /tmp/bun /tmp/bun.zip \
    && curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.tgz" \
        | tar -xz --strip-components=1 -C /usr/local/bin docker/docker \
    && rm -rf /var/lib/apt/lists/*
# ssh (deploy jobs) resolves the running uid via getpwuid; give uid 1000 a
# passwd entry matching the Titan user whose trees are bind-mounted in.
RUN groupadd -g 1000 olafurbui && useradd -u 1000 -g 1000 -M -d /home/olafurbui -s /bin/bash olafurbui
# Rustup PROXIES only (no toolchain baked in): jobs set RUSTUP_HOME to the
# bind-mounted host tree, so toolchains are shared with Titan. Proxies live in
# /usr/bin to match the PATH every repo's .akurai.yml already uses on Arch.
RUN curl -fsSL https://sh.rustup.rs -o /tmp/rustup-init.sh \
    && RUSTUP_HOME=/tmp/rustup-bootstrap CARGO_HOME=/tmp/rustup-bootstrap \
        sh /tmp/rustup-init.sh -y --no-modify-path --default-toolchain none --profile minimal >/dev/null \
    && install -m 755 /tmp/rustup-bootstrap/bin/rustup /usr/local/bin/rustup \
    && for proxy in cargo rustc rustdoc rustfmt cargo-fmt cargo-clippy clippy-driver rust-analyzer; do \
        ln -s /usr/local/bin/rustup "/usr/bin/$proxy"; done \
    && rm -rf /tmp/rustup-bootstrap /tmp/rustup-init.sh
COPY --from=build /src/target/release/akurai /usr/local/bin/akurai
ENTRYPOINT ["/usr/local/bin/akurai"]