-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
37 lines (36 loc) · 1.31 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
37 lines (36 loc) · 1.31 KB
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
#!/bin/sh
# Copyright 2026 Query Farm LLC - https://query.farm
#
# Dispatch the single vgi-code image into one of its transports:
# http (default) the HTTP server on $PORT (8000), bound 0.0.0.0 so a
# published host port reaches it. Serves /health.
# tcp raw Arrow-IPC over TCP on $PORT_TCP (8001), bound 0.0.0.0.
# Used by the VGI extension's transparently-shared container.
# stdio a worker DuckDB spawns over stdio (on-host execution).
# Any other first argument is exec'd verbatim (escape hatch for debugging).
#
# The worker is stateless (tree-sitter grammars compiled into the binary), so
# there is no /data to create and no state env to wire — each mode just exec's
# the binary.
set -e
case "${1:-http}" in
http)
shift 2>/dev/null || true
# `--http` reads its bind address from VGI_HTTP_BIND (default 127.0.0.1:0,
# an ephemeral loopback port). In a container we must bind 0.0.0.0 on a
# FIXED port so `-p $PORT:$PORT` and the HEALTHCHECK reach it.
export VGI_HTTP_BIND="0.0.0.0:${PORT:-8000}"
exec code-worker --http "$@"
;;
tcp)
shift 2>/dev/null || true
exec code-worker --tcp "0.0.0.0:${PORT_TCP:-8001}" "$@"
;;
stdio)
shift 2>/dev/null || true
exec code-worker "$@"
;;
*)
exec "$@"
;;
esac