Files
zkldi_Tachi/docker/Dockerfile.bot
T
2026-05-03 19:46:59 +01:00

36 lines
901 B
Docker

# Build context must be the repo root. Full tree + .dockerignore (see repo root).
# docker build -f docker/Dockerfile.bot .
FROM oven/bun:alpine AS base
WORKDIR /app
FROM base AS deps
COPY . .
RUN bun install --frozen-lockfile
FROM deps AS build
# Do not inline process.env at build time; binary reads runtime env from the host.
# Do not auto-load dotenv inside the standalone executable.
RUN bun build \
--compile \
--env=disable \
--no-compile-autoload-dotenv \
--target=bun \
./typescript/bot/src/main.ts \
--outfile /bot
# Runtime: `bun build --compile` links against libstdc++/libgcc; bare alpine:3.21 has neither.
# --- prod: nothing but the binary ---
FROM alpine:3.21 AS prod
RUN apk add --no-cache curl libstdc++ libgcc
COPY --from=build /bot /bot
HEALTHCHECK --interval=15s --timeout=5s \
CMD curl -sf http://localhost:${PORT:-8080}/.deploy/up || exit 1
CMD ["/bot"]