mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-27 17:38:11 +03:00
36 lines
901 B
Docker
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"]
|