From 4633aab0c9c1c86c0fcc9461b7fc39348fd57b66 Mon Sep 17 00:00:00 2001 From: Gabe M Date: Tue, 9 Jun 2026 23:37:07 -0600 Subject: [PATCH] fix(docker): handle sigterm & sigint --- packages/opencode/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/opencode/Dockerfile b/packages/opencode/Dockerfile index f92b48a6d1b5..796536698d9b 100644 --- a/packages/opencode/Dockerfile +++ b/packages/opencode/Dockerfile @@ -4,7 +4,7 @@ FROM alpine AS base # On ephemeral containers, the cache is not useful ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH} -RUN apk add libgcc libstdc++ ripgrep +RUN apk add libgcc libstdc++ ripgrep tini FROM base AS build-amd64 COPY dist/opencode-linux-x64-baseline-musl/bin/opencode /usr/local/bin/opencode @@ -15,4 +15,7 @@ COPY dist/opencode-linux-arm64-musl/bin/opencode /usr/local/bin/opencode ARG TARGETARCH FROM build-${TARGETARCH} RUN opencode --version -ENTRYPOINT ["opencode"] +# Run under tini as PID 1 so SIGINT/SIGTERM are forwarded to opencode and +# zombies are reaped. Without an init, PID 1 ignores signals that have no +# explicit handler (e.g. `serve`), so `^C` / `docker stop` would hang. +ENTRYPOINT ["tini", "--", "opencode"]