-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.06 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
# Stage 1: Builder
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lock ./
COPY prisma ./prisma
# Install dependencies (including devDependencies for build tools)
RUN bun install --frozen-lockfile
# Generate Prisma Client
RUN bun prisma generate
# Copy source code
COPY . .
RUN bun run build.ts
# Stage 2: Runner
FROM oven/bun:1 AS runner
WORKDIR /app
# Copy dependencies and build artifacts
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/src ./src
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/bunfig.toml ./bunfig.toml
COPY --from=builder /app/public ./public
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
COPY --from=builder /app/example-data ./example-data
# Create data directory
RUN mkdir -p data
# Expose port
EXPOSE 3000
# Set environment to production
ENV NODE_ENV=production
# Run migrations and start server
CMD ["sh", "-c", "bun prisma migrate deploy && bun src/index.ts"]