-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (78 loc) · 3.67 KB
/
Copy pathDockerfile
File metadata and controls
94 lines (78 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# ── Build from source (dev only) ─────────────────────────────────────
FROM oven/bun:1 AS build
WORKDIR /app
COPY package.json bun.lock tsconfig.json ./
RUN bun install --frozen-lockfile
COPY src/ src/
COPY scripts/ scripts/
COPY CLAUDE.md ./
ARG VERSION=dev
RUN echo "export const VERSION = \"${VERSION}\";" > src/version.ts
RUN bun build --compile src/index.ts --outfile /app/critters
# ── Shared runtime ───────────────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
openssh-client \
jq \
curl \
ca-certificates \
gnupg \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI (native binary)
RUN curl -fsSL https://claude.ai/install.sh | bash
ENV PATH="/root/.local/bin:${PATH}"
# Install Codex CLI
RUN npm install -g @openai/[email protected]
# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
> /etc/apt/sources.list.d/github-cli.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends gh \
&& rm -rf /var/lib/apt/lists/*
# Install ngrok (for optional tunnel support)
RUN curl -fsSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \
| gpg --dearmor -o /usr/share/keyrings/ngrok-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/ngrok-archive-keyring.gpg] https://ngrok-agent.s3.amazonaws.com buster main" \
> /etc/apt/sources.list.d/ngrok.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends ngrok \
&& rm -rf /var/lib/apt/lists/*
# Set default git identity for commits
RUN git config --global user.name "Critters" \
&& git config --global user.email "critters@noreply"
WORKDIR /app
EXPOSE 3847
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:3847/healthz || exit 1
CMD ["./critters", "--no-tmux", "--daemonized", "--json-logs", "--skip-update"]
# ── Prod: download release binary ────────────────────────────────────
# Usage: docker build --target prod .
# docker build --target prod --build-arg CRITTERS_VERSION=1.6.0 .
FROM runtime AS prod
ARG CRITTERS_VERSION=latest
RUN set -eux; \
ARCH=$(dpkg --print-architecture); \
case "$ARCH" in \
amd64) ASSET="critters-linux-x64" ;; \
arm64) ASSET="critters-linux-arm64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac; \
if [ "$CRITTERS_VERSION" = "latest" ]; then \
URL=$(curl -fsSL https://api.github.com/repos/ack-ventures/critters/releases/latest \
| jq -r --arg a "$ASSET" '.assets[] | select(.name == $a) | .browser_download_url'); \
else \
URL="https://github.com/ack-ventures/critters/releases/download/v${CRITTERS_VERSION}/${ASSET}"; \
fi; \
curl -fsSL -o /app/critters "$URL" \
&& chmod +x /app/critters
# ── Dev (default): build from source ─────────────────────────────────
# This is the default target (used by `docker build .` and CI).
FROM runtime AS dev
COPY --from=build /app/critters /app/critters