barreloflube commited on
Commit
2db575b
·
1 Parent(s): a2e085d

chore: Enhance Dockerfile for Bun production deployment with explicit configuration

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -7
Dockerfile CHANGED
@@ -1,15 +1,26 @@
1
- # Stage 1: Build the React/Vite application with Bun
2
- FROM oven/bun:1 AS builder
3
  WORKDIR /app
4
 
5
- # Install dependencies into temp directory
6
- # This will cache them and speed up future builds
7
  COPY package.json bun.lock ./
8
- RUN bun install
9
 
10
- # Copy all project files and build the application
 
 
 
11
  COPY . .
 
 
12
  ENV NODE_ENV=production
13
  RUN bun run build
14
 
15
- CMD ["bun", "run", "preview"]
 
 
 
 
 
 
 
 
 
1
+ # use the official Bun image
2
+ FROM oven/bun:1
3
  WORKDIR /app
4
 
5
+ # Copy package files
 
6
  COPY package.json bun.lock ./
 
7
 
8
+ # Install ALL dependencies (including dev dependencies)
9
+ RUN bun install --frozen-lockfile --non-interactive
10
+
11
+ # Copy all project files
12
  COPY . .
13
+
14
+ # Set production environment and build
15
  ENV NODE_ENV=production
16
  RUN bun run build
17
 
18
+ # Move Vite from devDependencies to dependencies for the preview server
19
+ # This ensures Vite is available at runtime in production environments
20
+ RUN bun add vite @vitejs/plugin-react
21
+
22
+ # Expose the port that the app will run on
23
+ EXPOSE 7860
24
+
25
+ # Use the preview command directly with Bun to avoid any script-related issues
26
+ CMD ["bun", "run", "--bun", "vite", "preview", "--host", "--port", "7860"]