Commit 5df1f0d
committed
fix: Fix production Dockerfile for ES modules
🔧 Production Docker Fix
## Issue Fixed:
- Production container failing with 'Cannot find module /app/dist/main.js'
- ES modules not properly handled in production build
## Solution:
- Simplified Dockerfile.prod to single-stage build
- Install all dependencies for build, then prune dev dependencies
- Direct ES module execution: 'node dist/main.js'
- Proper file copying and permissions
## Key Changes:
- Removed complex multi-stage build
- Added npm prune --production after build
- Direct node execution instead of npm script
- Maintained all necessary system dependencies
This fixes the production deployment issue where the NestJS
application wasn't starting due to ES module configuration.1 parent f72083f commit 5df1f0d
1 file changed
Lines changed: 6 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
6 | 3 | | |
7 | 4 | | |
8 | 5 | | |
| |||
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 18 | + | |
28 | 19 | | |
29 | 20 | | |
30 | 21 | | |
| |||
33 | 24 | | |
34 | 25 | | |
35 | 26 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 27 | + | |
| 28 | + | |
54 | 29 | | |
55 | 30 | | |
56 | 31 | | |
| |||
63 | 38 | | |
64 | 39 | | |
65 | 40 | | |
66 | | - | |
67 | | - | |
| 41 | + | |
| 42 | + | |
0 commit comments