Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build outputs
dist/
build/

# Development files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Git
.git/
.gitignore

# Logs
logs/
*.log

# Runtime data
pids/
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/

# Database files
*.db
*.db-shm
*.db-wal
store.db*

# Temporary files
tmp/
temp/

# Documentation
README.md
docs/

# Docker files (avoid recursive copying)
Dockerfile*
docker-compose*.yml
.dockerignore

# Test files
test/
tests/
__tests__/
*.test.js
*.spec.js
40 changes: 40 additions & 0 deletions .env.docker.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Docker Environment Configuration for Claude Code UI
# Copy this file to .env.docker.local and modify as needed

# =============================================================================
# SERVER CONFIGURATION
# =============================================================================

NODE_ENV=development
PORT=4001
VITE_PORT=5173

# =============================================================================
# API KEYS (Set these in your environment or docker-compose override)
# =============================================================================
ANTHROPIC_API_KEY=
ANTHROPIC_BASE_URL=
ANTHROPIC_AUTH_TOKEN=
ANTHROPIC_SMALL_FAST_MODEL=
ANTHROPIC_MODEL=
ALL_PROXY=

# =============================================================================
# PATHS (Docker Container Paths)
# =============================================================================
# These paths are inside the container and mapped via docker-compose volumes
CLAUDE_CONFIG_PATH=/home/nodejs/.claude
PROJECTS_PATH=/home/nodejs/Projects
UPLOADS_PATH=/app/uploads
DATA_PATH=/app/data

# =============================================================================
# CONTAINER SPECIFIC SETTINGS
# =============================================================================
# Timezone
TZ=Shanghai/Asia

# Container user settings
CONTAINER_USER=nodejs
CONTAINER_UID=1001
CONTAINER_GID=1001
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ out/

# Environment variables
.env
.env.*
!.env.*.example
.env.local
.env.development.local
.env.test.local
Expand Down
89 changes: 89 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Multi-stage Dockerfile for Claude Code UI
# Stage 1: Build frontend
FROM node:20-alpine AS frontend-builder

WORKDIR /app

# Install build dependencies for native modules
RUN apk add --no-cache python3 python3-dev py3-setuptools make g++ bash

# Copy package files
COPY package*.json ./
COPY vite.config.js ./
COPY tailwind.config.js ./
COPY postcss.config.js ./
COPY index.html ./

# Install all dependencies (including devDependencies for build)
RUN npm ci

# Copy frontend source
COPY src/ ./src/
COPY public/ ./public/

# Build frontend
RUN npm run build

# Stage 2: Production environment with all dependencies
FROM node:20-alpine AS production

# Install system dependencies
RUN apk update && apk add --no-cache \
python3 \
python3-dev \
py3-pip \
py3-setuptools \
build-base \
linux-headers \
curl \
bash \
git \
sqlite \
&& rm -rf /var/cache/apk/*

# Install uv for Python package management
RUN pip3 install --no-cache-dir --break-system-packages uv

# Install Claude CLI
RUN npm install -g @anthropic-ai/claude-code@latest

# Create app user and group
RUN addgroup -g 1001 -S nodejs && \
adduser -S -u 1001 -G nodejs -h /home/nodejs -s /bin/bash nodejs

# Create app directory
WORKDIR /app

# Copy package files and install backend dependencies
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force

# Copy backend source
COPY server/ ./server/

# Copy built frontend from stage 1
COPY --from=frontend-builder /app/dist ./dist

# Create necessary directories and set permissions
RUN mkdir -p /home/nodejs/.claude && \
mkdir -p /app/uploads && \
mkdir -p /app/data && \
chown -R nodejs:nodejs /app && \
chown -R nodejs:nodejs /home/nodejs

# Copy startup script
COPY docker/start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh

# Switch to app user
USER nodejs

# Expose port
EXPOSE 3001

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3001/api/config || exit 1

# Start the application
CMD ["/usr/local/bin/start.sh"]
Loading