-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (37 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
55 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Multi-stage Dockerfile for Bun-based ChatGPT App
# Build stage
FROM oven/bun:1 as builder
WORKDIR /app
# Copy package files
COPY package.json bun.lockb* ./
# Install all dependencies (including dev dependencies for building)
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Accept build arguments
ARG VITE_PRIVY_APP_ID
# Set environment variables from build arguments
ENV VITE_PRIVY_APP_ID=$VITE_PRIVY_APP_ID
# Build everything (client, widgets, server)
RUN bun run build
# Production stage
FROM oven/bun:1
WORKDIR /app
# Copy package files
COPY package.json bun.lockb* ./
# Install production dependencies only
RUN bun install --production --frozen-lockfile
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
# Copy public assets (favicon, etc.)
COPY --from=builder /app/public ./public
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3002
# Expose port
EXPOSE 3002
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD bun -e "fetch('http://localhost:3002/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"
# Run the server
CMD ["bun", "run", "start"]