Add Dockerfile with multi-stage build for CLI binary

This commit is contained in:
Jared Miller 2026-01-28 17:07:07 -05:00
parent 9f27e3a3fa
commit 533d61d828
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

36
Dockerfile Normal file
View file

@ -0,0 +1,36 @@
# Build stage
FROM oven/bun:1 AS builder
WORKDIR /app
# Install dependencies
COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile
# Copy source files
COPY . .
# Build CLI binary (smallest possible)
RUN mkdir -p dist/bin && \
bun build --compile --minify --sourcemap=none --target=bun-linux-x64 \
src/cli.ts --outfile dist/bin/claude-remote
# Runtime stage - for running the server
FROM oven/bun:1-slim
WORKDIR /app
# Copy only what's needed for server
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/src ./src
COPY --from=builder /app/package.json ./
# Copy CLI binary for extraction if needed
COPY --from=builder /app/dist/bin/claude-remote /app/dist/bin/
# Create data directory
RUN mkdir -p data/prod
ENV PORT=7200
ENV DB_PATH=/app/data/prod/claude-remote.db
EXPOSE 7200
CMD ["bun", "run", "src/server.ts"]