diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..9daa01bb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,73 @@ +node_modules +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# Logs +logs +*.log + +# Dependency directories +node_modules/ +jspm_packages/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Git +.git +.gitignore + +# Docker +Dockerfile* +docker-compose* +.dockerignore + +# Build output +dist/ +build/ + +# Development files +.env.example \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ba2e869e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# Use Node.js version from .nvmrc +FROM node:20.19.3-alpine + +# Set working directory +WORKDIR /app + +# Install system dependencies needed for some npm packages +RUN apk add --no-cache \ + python3 \ + make \ + g++ \ + sqlite \ + curl + +# Install Claude Code CLI +RUN npm install -g @anthropic-ai/claude-code + +# Copy package files +COPY package*.json ./ + +# Install all dependencies (including dev dependencies for build) +RUN npm ci + +# Copy source code +COPY . . + +# Build the frontend +RUN npm run build + +# Remove dev dependencies to reduce image size +RUN npm ci --only=production && npm cache clean --force + +# Create non-root user for security +RUN addgroup -g 1001 -S nodejs +RUN adduser -S nextjs -u 1001 + +# Change ownership of app directory +RUN chown -R nextjs:nodejs /app +USER nextjs + +# Expose port +EXPOSE 3008 + +# Start the server only (build already completed) +CMD ["npm", "run", "server"] \ No newline at end of file diff --git a/README.md b/README.md index ad33afea..3e91354d 100755 --- a/README.md +++ b/README.md @@ -72,11 +72,38 @@ cp .env.example .env # Development mode (with hot reload) npm run dev +# Production mode +npm start ``` The application will start at the port you specified in your .env 5. **Open your browser:** - - Development: `http://localhost:3001` + - Development: `http://localhost:3009` + - Production: `http://localhost:3008` + +### Docker Installation (Recommended) + +For easier deployment and consistent environment: + +1. **Clone and setup:** +```bash +git clone https://github.com/siteboon/claudecodeui.git +cd claudecodeui +``` + +2. **Run with Docker Compose:** +```bash +docker-compose up -d +``` + +3. **Open your browser:** + - Application: `http://localhost:3008` + +**Docker benefits:** +- Consistent environment across all platforms +- No need to install Node.js or manage dependencies +- Automatic restart on system reboot +- Persistent data storage for sessions and projects ## Security & Tools Configuration diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..746793f6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +services: + claude-code-ui: + build: . + ports: + - "3008:3008" + environment: + - PORT=3008 + - VITE_PORT=3009 + - NODE_ENV=production + volumes: + # Mount a volume for the SQLite database to persist data + - claude_data:/app/server/database + # Mount Claude Code directories and projects from host + - ~/.claude:/home/nextjs/.claude:ro + - ~/:/home/nextjs/host_home:ro + # Mount common project directories (adjust paths as needed) + - ~/Projects:/home/nextjs/Projects + - ~/Documents:/home/nextjs/Documents + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3008/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + +volumes: + claude_data: + driver: local \ No newline at end of file