-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (52 loc) · 1.66 KB
/
Dockerfile
File metadata and controls
71 lines (52 loc) · 1.66 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# ---- Builder Stage ----
FROM oven/bun:1.2 AS builder
WORKDIR /app
# Create data directories
RUN mkdir -p data repos
# Copy package.json
COPY apps/server/package.json ./
RUN bun install
# Copy source code required for the build
COPY apps/server/src ./src
COPY apps/server/prompts ./prompts
COPY apps/server/scripts ./scripts
COPY apps/server/build.ts ./
COPY apps/server/tsconfig.json ./
COPY apps/server/drizzle.config.ts ./
# Run the build script (defined in package.json)
# This will create the /app/dist directory
RUN bun run build --sourcemap
# ---- Final Stage ----
FROM oven/bun:1.2
WORKDIR /app
# Install only essential Docker packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
docker.io \
curl \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy package.json from the builder stage
COPY --from=builder /app/package.json ./
# Install only production dependencies
RUN bun install --production --no-optional
# Copy the built application (dist directory) from the builder stage
COPY --from=builder /app/dist ./
COPY apps/server/drizzle.config.ts ./
COPY apps/server/src/db/schema.ts ./src/db/schema.ts
# Copy the entrypoint script
COPY apps/server/entrypoint.sh .
RUN chmod +x ./entrypoint.sh
# Set environment variables for better performance
ENV NODE_ENV=production
ENV BUN_ENV=production
# Expose the application port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# Set the entrypoint
ENTRYPOINT ["./entrypoint.sh"]
# Start the application (this will be passed to entrypoint.sh)
CMD ["bun", "app.js"]