# arcote/runtime — generic Arc platform runtime container.
#
# Image is intentionally version-agnostic. CLI version comes from the
# ARC_CLI_VERSION env var set by docker-compose (generated per-deploy by
# `arc platform deploy`), so a single `arcote/runtime:1` tag serves every
# CLI release. Bumping CLI only requires `bun publish` — no image rebuild.
#
# Layout in container:
#   /app/.arc/cli/<ARC_CLI_VERSION>/   ← arc-cli + direct deps (installed by entrypoint, cached)
#   /app/.arc/platform/                ← user volume: code, framework + per-module deps
#   /app/.arc/data/                    ← user volume: sqlite
#   /root/.bun/install/cache/          ← shared bun store (volume)

FROM oven/bun:1-alpine

# tini for proper signal handling. build-base/python3/git in case any user dep
# has a native postinstall step (e.g. better-sqlite3). curl for healthchecks.
RUN apk add --no-cache tini ca-certificates build-base python3 git curl

WORKDIR /app

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 5005
ENV PORT=5005 \
    ARC_DEPLOY_API=1

ENTRYPOINT ["tini", "--", "/entrypoint.sh"]
