Add Dockerfile with multi-stage build for CLI binary
This commit is contained in:
parent
9f27e3a3fa
commit
533d61d828
1 changed files with 36 additions and 0 deletions
36
Dockerfile
Normal file
36
Dockerfile
Normal 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"]
|
||||||
Loading…
Reference in a new issue