File tree Expand file tree Collapse file tree 5 files changed +49
-4
lines changed Expand file tree Collapse file tree 5 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ yarn-error.log
13
13
.next
14
14
out
15
15
16
- # Python
16
+ # Python cache files (but keep api/ directory)
17
17
__pycache__ /
18
18
* .py [cod ]
19
19
* $py.class
34
34
* .egg-info /
35
35
.installed.cfg
36
36
* .egg
37
+ # Keep api/ directory but exclude cache
38
+ api /__pycache__ /
39
+ api /* .pyc
37
40
38
41
# Environment variables
39
42
# .env is now allowed to be included in the build
Original file line number Diff line number Diff line change @@ -10,7 +10,13 @@ RUN npm ci --legacy-peer-deps
10
10
FROM node_base AS node_builder
11
11
WORKDIR /app
12
12
COPY --from=node_deps /app/node_modules ./node_modules
13
- COPY --exclude=./api . .
13
+ # Copy only necessary files for Next.js build
14
+ COPY package.json package-lock.json next.config.ts tsconfig.json tailwind.config.js postcss.config.mjs ./
15
+ COPY src/ ./src/
16
+ COPY public/ ./public/
17
+ # Increase Node.js memory limit for build and disable telemetry
18
+ ENV NODE_OPTIONS="--max-old-space-size=4096"
19
+ ENV NEXT_TELEMETRY_DISABLED=1
14
20
RUN NODE_ENV=production npm run build
15
21
16
22
FROM python:3.11-slim AS py_deps
Original file line number Diff line number Diff line change 48
48
logger .info (f"Starting Streaming API on port { port } " )
49
49
50
50
# Run the FastAPI app with uvicorn
51
+ # Disable reload in production/Docker environment
52
+ is_development = os .environ .get ("NODE_ENV" ) != "production"
51
53
uvicorn .run (
52
54
"api.api:app" ,
53
55
host = "0.0.0.0" ,
54
56
port = port ,
55
- reload = True
57
+ reload = is_development
56
58
)
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ version: '3.8'
2
2
3
3
services :
4
4
deepwiki :
5
- build : .
5
+ build :
6
+ context : .
7
+ dockerfile : Dockerfile
6
8
ports :
7
9
- " ${PORT:-8001}:${PORT:-8001}" # API port
8
10
- " 3000:3000" # Next.js port
@@ -12,5 +14,9 @@ services:
12
14
- PORT=${PORT:-8001}
13
15
- NODE_ENV=production
14
16
- SERVER_BASE_URL=http://localhost:${PORT:-8001}
17
+ - NEXT_PUBLIC_SERVER_BASE_URL=http://localhost:${PORT:-8001}
15
18
volumes :
16
19
- ~/.adalflow:/root/.adalflow # Persist repository and embedding data
20
+ # Resource limits for docker-compose up (not Swarm mode)
21
+ mem_limit : 6g
22
+ mem_reservation : 2g
Original file line number Diff line number Diff line change @@ -5,6 +5,34 @@ const TARGET_SERVER_BASE_URL = process.env.SERVER_BASE_URL || 'http://localhost:
5
5
const nextConfig : NextConfig = {
6
6
/* config options here */
7
7
output : 'standalone' ,
8
+ // Optimize build for Docker
9
+ experimental : {
10
+ optimizePackageImports : [ '@mermaid-js/mermaid' , 'react-syntax-highlighter' ] ,
11
+ } ,
12
+ // Reduce memory usage during build
13
+ webpack : ( config , { isServer } ) => {
14
+ if ( ! isServer ) {
15
+ config . resolve . fallback = {
16
+ ...config . resolve . fallback ,
17
+ fs : false ,
18
+ } ;
19
+ }
20
+ // Optimize bundle size
21
+ config . optimization = {
22
+ ...config . optimization ,
23
+ splitChunks : {
24
+ chunks : 'all' ,
25
+ cacheGroups : {
26
+ vendor : {
27
+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ,
28
+ name : 'vendors' ,
29
+ chunks : 'all' ,
30
+ } ,
31
+ } ,
32
+ } ,
33
+ } ;
34
+ return config ;
35
+ } ,
8
36
async rewrites ( ) {
9
37
return [
10
38
{
You can’t perform that action at this time.
0 commit comments