# Build context must be the repo root. Full tree + .dockerignore (see repo root). # docker build -f docker/Dockerfile.ghbot \ # --build-arg GIT_REVISION="$(git rev-parse HEAD)" \ # --build-arg BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ # . 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/github-bot/src/main.ts \ --outfile /ghbot # 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 ARG GIT_REVISION ARG BUILD_TIME # Fail the build if any arg is omitted (Docker has no required-ARG syntax). RUN set -eu; \ : "${GIT_REVISION:?Dockerfile.ghbot: GIT_REVISION build-arg is required}"; \ : "${BUILD_TIME:?Dockerfile.ghbot: BUILD_TIME build-arg is required}"; RUN apk add --no-cache curl libstdc++ libgcc COPY --from=build /ghbot /ghbot LABEL service="tachi-ghbot" \ org.opencontainers.image.source="https://github.com/zkldi/Tachi3" \ org.opencontainers.image.revision="${GIT_REVISION}" \ org.opencontainers.image.created="${BUILD_TIME}" HEALTHCHECK --interval=15s --timeout=5s \ CMD curl -sf http://localhost:${PORT:-8080}/.deploy/up || exit 1 CMD ["/ghbot"]