summaryrefslogtreecommitdiffhomepage
path: root/Dockerfile.dev
blob: 9614564035b2ed04fd4395db98afa47375ae60bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# --- cs (code spelunker) builder ---
# Builds a patched, statically-linked `cs` binary for the search_code tool.
# Pinned to the v3.1.0 commit for reproducibility; the patch adds Luau
# declaration support and corrects fuzzy edit-distance matching (see
# docker/cs/luau-declarations.patch and docker/cs/fuzzy-distance.patch). cs vendors its
# dependencies, so the `go build` step is offline after the clone.
FROM golang:1.25-bookworm AS cs-builder
ARG CS_COMMIT=697e0bf194bbc7a4a877e5170c70618989fc92e7
WORKDIR /build
COPY docker/cs/luau-declarations.patch /tmp/luau-declarations.patch
COPY docker/cs/fuzzy-distance.patch /tmp/fuzzy-distance.patch
RUN git clone https://github.com/boyter/cs.git src \
	&& cd src \
	&& git checkout "${CS_COMMIT}" \
	&& git apply /tmp/luau-declarations.patch \
	&& git apply /tmp/fuzzy-distance.patch \
	&& CGO_ENABLED=0 go build -mod=vendor -ldflags="-s -w" -o /usr/local/bin/cs . \
	&& /usr/local/bin/cs --version

FROM oven/bun:1

WORKDIR /app

# ─── Roblox Luau tooling (luau-lsp + rojo) ──────────────────────
# The LSP test bed under references/stunt-olympics/ drives Dispatch's
# luau-lsp integration: diagnostics-on-write and the `lsp` tool. Both
# `luau-lsp` and `rojo` must be on PATH inside the container (luau-lsp's
# sourcemap.autogenerate shells out to `rojo sourcemap --watch`). The base
# oven/bun image ships neither curl nor unzip, so install those first.
#
# Versions are pinned for reproducible builds; bump via --build-arg.
ARG LUAU_LSP_VERSION=1.68.0
ARG ROJO_VERSION=7.6.1
RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends curl unzip ca-certificates; \
    rm -rf /var/lib/apt/lists/*; \
    arch="$(uname -m)"; \
    case "$arch" in \
        x86_64)  luau_asset="luau-lsp-linux-x86_64.zip"; rojo_asset="rojo-${ROJO_VERSION}-linux-x86_64.zip" ;; \
        aarch64) luau_asset="luau-lsp-linux-arm64.zip";   rojo_asset="rojo-${ROJO_VERSION}-linux-aarch64.zip" ;; \
        *) echo "Unsupported arch: $arch" >&2; exit 1 ;; \
    esac; \
    tmp="$(mktemp -d)"; \
    curl -fsSL "https://github.com/JohnnyMorganz/luau-lsp/releases/download/${LUAU_LSP_VERSION}/${luau_asset}" -o "$tmp/luau-lsp.zip"; \
    unzip -q "$tmp/luau-lsp.zip" -d "$tmp/luau-lsp"; \
    install -m 0755 "$tmp/luau-lsp/luau-lsp" /usr/local/bin/luau-lsp; \
    curl -fsSL "https://github.com/rojo-rbx/rojo/releases/download/v${ROJO_VERSION}/${rojo_asset}" -o "$tmp/rojo.zip"; \
    unzip -q "$tmp/rojo.zip" -d "$tmp/rojo"; \
    install -m 0755 "$tmp/rojo/rojo" /usr/local/bin/rojo; \
    rm -rf "$tmp"; \
    luau-lsp --version; \
    rojo --version

# Copy dependency files for layer caching
COPY package.json bun.lock ./
COPY packages/core/package.json packages/core/package.json
COPY packages/api/package.json packages/api/package.json
COPY packages/frontend/package.json packages/frontend/package.json

# Install dependencies (cached unless package files change)
RUN bun install

# Bundle the patched `cs` code-search binary for the search_code tool
COPY --from=cs-builder /usr/local/bin/cs /usr/local/bin/cs

# Source code is volume-mounted at runtime, overriding this copy
COPY . .

# Dev entrypoint: re-runs bun install to pick up dependency changes, then exec's the command
COPY docker/entrypoint.dev.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]