From 6a835293a5f3c65a6cf4a72f7450b28a0bf2ee3b Mon Sep 17 00:00:00 2001 From: Clayton Young Date: Wed, 26 Mar 2025 15:28:54 -0400 Subject: [PATCH] use roo code to fix error preventing .\docker-start.bat from working in Windows --- docker-compose.yml | 75 +++++++++++++++++++++++++- next.config.mjs | 49 ++++++++++++++++- postcss.config.mjs | 8 ++- scripts/docker/docker-start.bat | 54 +++++++++++++++++++ tailwind.config.ts | 96 ++++++++++++++++++++++++++++++++- tsconfig.json | 28 +++++++++- 6 files changed, 305 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index dc6309a..f5aba54 120000 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,74 @@ -docker/compose/docker-compose.yml \ No newline at end of file +services: + frontend: + build: + context: . + dockerfile: docker/dockerfiles/Dockerfile.frontend + container_name: devdocs-frontend + ports: + - "3001:3001" + environment: + - BACKEND_URL=http://backend:24125 + - MCP_HOST=mcp + depends_on: + - backend + networks: + - devdocs-network + restart: unless-stopped + backend: + build: + context: . + dockerfile: docker/dockerfiles/Dockerfile.backend + container_name: devdocs-backend + ports: + - "24125:24125" + volumes: + - ./storage:/app/storage + - ./logs:/app/logs + - ./crawl_results:/app/crawl_results + environment: + - MCP_HOST=mcp + - CRAWL4AI_URL=http://crawl4ai:11235 + - CRAWL4AI_API_TOKEN=${CRAWL4AI_API_TOKEN:-devdocs-demo-key} + depends_on: + - crawl4ai + - mcp + networks: + - devdocs-network + restart: unless-stopped + mcp: + build: + context: . + dockerfile: docker/dockerfiles/Dockerfile.mcp + container_name: devdocs-mcp + volumes: + - ./storage/markdown:/app/storage/markdown + - ./logs:/app/logs + networks: + - devdocs-network + stdin_open: true # Keep stdin open + tty: true # Allocate a pseudo-TTY + restart: unless-stopped + crawl4ai: + image: unclecode/crawl4ai:all + container_name: devdocs-crawl4ai + ports: + - "11235:11235" + environment: + - CRAWL4AI_API_TOKEN=${CRAWL4AI_API_TOKEN:-devdocs-demo-key} + - MAX_CONCURRENT_TASKS=5 + - DISABLE_AUTH=false + volumes: + - /dev/shm:/dev/shm + - ./crawl_results:/app/crawl_results + networks: + - devdocs-network + restart: unless-stopped + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 1G +networks: + devdocs-network: + driver: bridge diff --git a/next.config.mjs b/next.config.mjs index 24c1f0b..bfab29f 120000 --- a/next.config.mjs +++ b/next.config.mjs @@ -1 +1,48 @@ -config/next.config.mjs \ No newline at end of file +let userConfig = undefined +try { + userConfig = await import('./v0-user-next.config') +} catch (e) { + // ignore error +} +/** @type {import('next').NextConfig} */ +const nextConfig = { + // Removed standalone output mode as we're using a simpler Docker approach + eslint: { + ignoreDuringBuilds: true, + }, + typescript: { + ignoreBuildErrors: true, + }, + images: { + unoptimized: true, + }, + experimental: { + webpackBuildWorker: true, + parallelServerBuildTraces: true, + parallelServerCompiles: true, + }, + env: { + BACKEND_URL: process.env.BACKEND_URL || 'http://localhost:24125', + MCP_HOST: process.env.MCP_HOST || 'localhost', + }, +} +mergeConfig(nextConfig, userConfig) +function mergeConfig(nextConfig, userConfig) { + if (userConfig) { + return + } + for (const key in userConfig) { + if ( + typeof nextConfig[key] === 'object' && + Array.isArray(nextConfig[key]) + ) { + nextConfig[key] = { + ...nextConfig[key], + ...userConfig[key], + } + } else { + nextConfig[key] = userConfig[key] + } + } +} +export default nextConfig diff --git a/postcss.config.mjs b/postcss.config.mjs index d0a009e..cc5b9e0 120000 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -1 +1,7 @@ -config/postcss.config.mjs \ No newline at end of file +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: { + tailwindcss: {}, + }, +}; +export default config; diff --git a/scripts/docker/docker-start.bat b/scripts/docker/docker-start.bat index 73aab1a..44795bb 100644 --- a/scripts/docker/docker-start.bat +++ b/scripts/docker/docker-start.bat @@ -27,6 +27,60 @@ if exist "docker/compose/docker-compose.yml" ( echo %RED%Warning: Could not find docker/compose/docker-compose.yml%NC% ) +:: Fix configuration files for Docker build +echo %BLUE%Ensuring configuration files are properly set up...%NC% + +:: Copy next.config.mjs +if exist "config/next.config.mjs" ( + :: Create a temporary file with the correct content and encoding + type nul > next.config.mjs.tmp + :: Copy content line by line to ensure proper line endings + for /f "usebackq delims=" %%a in ("config/next.config.mjs") do ( + echo %%a>> next.config.mjs.tmp + ) + :: Replace the original file + move /y next.config.mjs.tmp next.config.mjs + echo %GREEN%next.config.mjs has been fixed for Docker compatibility%NC% +) else ( + echo %RED%Warning: Could not find config/next.config.mjs%NC% +) + +:: Copy postcss.config.mjs +if exist "config/postcss.config.mjs" ( + type nul > postcss.config.mjs.tmp + for /f "usebackq delims=" %%a in ("config/postcss.config.mjs") do ( + echo %%a>> postcss.config.mjs.tmp + ) + move /y postcss.config.mjs.tmp postcss.config.mjs + echo %GREEN%postcss.config.mjs has been fixed for Docker compatibility%NC% +) else ( + echo %RED%Warning: Could not find config/postcss.config.mjs%NC% +) + +:: Copy tailwind.config.ts +if exist "config/tailwind.config.ts" ( + type nul > tailwind.config.ts.tmp + for /f "usebackq delims=" %%a in ("config/tailwind.config.ts") do ( + echo %%a>> tailwind.config.ts.tmp + ) + move /y tailwind.config.ts.tmp tailwind.config.ts + echo %GREEN%tailwind.config.ts has been fixed for Docker compatibility%NC% +) else ( + echo %RED%Warning: Could not find config/tailwind.config.ts%NC% +) + +:: Copy tsconfig.json +if exist "config/tsconfig.json" ( + type nul > tsconfig.json.tmp + for /f "usebackq delims=" %%a in ("config/tsconfig.json") do ( + echo %%a>> tsconfig.json.tmp + ) + move /y tsconfig.json.tmp tsconfig.json + echo %GREEN%tsconfig.json has been fixed for Docker compatibility%NC% +) else ( + echo %RED%Warning: Could not find config/tsconfig.json%NC% +) + :: Create necessary directories with proper permissions echo %BLUE%Creating necessary directories...%NC% if not exist logs mkdir logs diff --git a/tailwind.config.ts b/tailwind.config.ts index 7ec315d..3d434a0 120000 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1 +1,95 @@ -config/tailwind.config.ts \ No newline at end of file +import type { Config } from "tailwindcss"; +const config: Config = { + darkMode: ["class"], + content: [ + "./pages/**/*.{js,ts,jsx,tsx,mdx}", + "./components/**/*.{js,ts,jsx,tsx,mdx}", + "./app/**/*.{js,ts,jsx,tsx,mdx}", + "*.{js,ts,jsx,tsx,mdx}" + ], + theme: { + extend: { + colors: { + background: 'hsl(var(--background))', + foreground: 'hsl(var(--foreground))', + card: { + DEFAULT: 'hsl(var(--card))', + foreground: 'hsl(var(--card-foreground))' + }, + popover: { + DEFAULT: 'hsl(var(--popover))', + foreground: 'hsl(var(--popover-foreground))' + }, + primary: { + DEFAULT: 'hsl(var(--primary))', + foreground: 'hsl(var(--primary-foreground))' + }, + secondary: { + DEFAULT: 'hsl(var(--secondary))', + foreground: 'hsl(var(--secondary-foreground))' + }, + muted: { + DEFAULT: 'hsl(var(--muted))', + foreground: 'hsl(var(--muted-foreground))' + }, + accent: { + DEFAULT: 'hsl(var(--accent))', + foreground: 'hsl(var(--accent-foreground))' + }, + destructive: { + DEFAULT: 'hsl(var(--destructive))', + foreground: 'hsl(var(--destructive-foreground))' + }, + border: 'hsl(var(--border))', + input: 'hsl(var(--input))', + ring: 'hsl(var(--ring))', + chart: { + '1': 'hsl(var(--chart-1))', + '2': 'hsl(var(--chart-2))', + '3': 'hsl(var(--chart-3))', + '4': 'hsl(var(--chart-4))', + '5': 'hsl(var(--chart-5))' + }, + sidebar: { + DEFAULT: 'hsl(var(--sidebar-background))', + foreground: 'hsl(var(--sidebar-foreground))', + primary: 'hsl(var(--sidebar-primary))', + 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))', + accent: 'hsl(var(--sidebar-accent))', + 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))', + border: 'hsl(var(--sidebar-border))', + ring: 'hsl(var(--sidebar-ring))' + } + }, + borderRadius: { + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)' + }, + keyframes: { + 'accordion-down': { + from: { + height: '0' + }, + to: { + height: 'var(--radix-accordion-content-height)' + } + }, + 'accordion-up': { + from: { + height: 'var(--radix-accordion-content-height)' + }, + to: { + height: '0' + } + } + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out' + } + } + }, + plugins: [require("tailwindcss-animate")], +}; +export default config; diff --git a/tsconfig.json b/tsconfig.json index 036882f..4b2dc7b 120000 --- a/tsconfig.json +++ b/tsconfig.json @@ -1 +1,27 @@ -config/tsconfig.json \ No newline at end of file +{ + "compilerOptions": { + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "target": "ES6", + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +}