Files
heicode/Dockerfile
T
gongzhiyong a09d909dcd
Deploy VitePress Docs / build (push) Failing after 1m49s
Deploy VitePress Docs / deploy (push) Has been skipped
feat: rebrand to HeiCode and add dual-provider auth flow
Rebrand cc-haha to HeiCode and implement TaijiAICloud/ClawdRouter login foundations across server and desktop, including provider presets, model discovery endpoints, and login UI/store scaffolding for OAuth and token paste flows.
2026-04-29 19:08:06 +08:00

60 lines
2.0 KiB
Docker

# HeiCode Server — local API/WebSocket server in a container.
#
# NOTE:
# We intentionally do NOT use `FROM oven/bun:*` here because some environments
# have intermittent Docker Hub TLS proxy issues when pulling that image.
# Instead we use alpine (already commonly cached) and download Bun directly
# from GitHub release assets during build.
#
# Build: docker build -t heicode-server -f Dockerfile .
# Run: see docker-compose.yml at the repo root.
FROM alpine:latest
# Bun on Alpine still needs libstdc++/libgcc at runtime.
# Network to Alpine mirrors can be flaky in this environment, so retry.
RUN set -eux; \
for i in 1 2 3 4 5 6 7 8; do \
apk add --no-cache libstdc++ libgcc && break; \
echo "apk add failed (attempt ${i}), retrying..."; \
sleep 3; \
done
# Install Bun (musl build for Alpine on arm64) from a local build asset.
# This avoids flaky outbound TLS during `docker build` in restricted networks.
COPY .docker-assets/bun-linux-aarch64-musl.zip /tmp/bun.zip
RUN busybox unzip -q /tmp/bun.zip -d /tmp \
&& mv /tmp/bun-linux-aarch64-musl/bun /usr/local/bin/bun \
&& chmod +x /usr/local/bin/bun \
&& rm -rf /tmp/bun.zip /tmp/bun-linux-aarch64-musl
WORKDIR /app
# Install dependencies in a separate layer to maximise cache hits across
# code-only changes.
COPY package.json bun.lock bunfig.toml preload.ts ./
RUN bun install --frozen-lockfile
# Copy the rest of the source. We deliberately *don't* copy the desktop/
# Tauri tree because the server doesn't need it; it dramatically speeds up
# the build and keeps the image lean. The `desktop/` folder lives in the
# repo only as a sibling project.
COPY tsconfig.json ./
COPY src ./src
COPY adapters ./adapters
COPY runtime ./runtime
COPY stubs ./stubs
COPY fixtures ./fixtures
COPY bin ./bin
# Default port the server listens on.
ENV SERVER_PORT=3456
ENV SERVER_HOST=0.0.0.0
# Bind to /data so cc-haha's ~/.claude config persists across container restarts.
ENV CLAUDE_CONFIG_DIR=/data/.claude
RUN mkdir -p /data/.claude
EXPOSE 3456
CMD ["bun", "run", "src/server/index.ts"]