forked from agentlogs/agentlogs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.27 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
FROM oven/bun:1.3 AS build
WORKDIR /app
# Copy workspace config and package files for dependency installation
COPY package.json bun.lock ./
COPY packages/web/package.json packages/web/
COPY packages/shared/package.json packages/shared/
COPY packages/cli/package.json packages/cli/
# Install dependencies
RUN bun install --ignore-scripts
# Copy source code
COPY . .
# Build the web application
RUN bun --cwd packages/web build
# Runtime stage - Node.js Alpine (postgres.js is pure JS, no native modules needed)
FROM node:22-alpine AS runtime
WORKDIR /app
# Set up ESM module type
RUN echo '{"type":"module"}' > package.json
# Copy built output
COPY --from=build /app/packages/web/dist dist
# Copy migration and server scripts
COPY --from=build /app/packages/web/migrations migrations
COPY --from=build /app/packages/web/scripts/migrate.mjs scripts/migrate.mjs
COPY --from=build /app/packages/web/scripts/serve.mjs scripts/serve.mjs
# Install runtime dependencies (pure JS, no native builds)
RUN npm install postgres drizzle-orm @aws-sdk/client-s3
# Create data directories
RUN mkdir -p /data/storage
EXPOSE 3000
ENV STORAGE_PATH=/data/storage
ENV PORT=3000
ENV NODE_ENV=production
# Run migrations then start server
CMD ["sh", "-c", "node scripts/migrate.mjs && node scripts/serve.mjs"]