-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (48 loc) · 1.74 KB
/
Dockerfile
File metadata and controls
66 lines (48 loc) · 1.74 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
# Multi-stage Dockerfile for AgentCmd
# Optimized for E2E testing with Playwright
# Stage 1: Base
FROM node:22-alpine AS base
WORKDIR /app
# Stage 2: Dependencies
FROM base AS dependencies
# Install build tools (required for node-pty native module)
RUN apk add --no-cache python3 make g++
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
# Copy workspace configuration
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
# Copy all package.json files
COPY packages/agent-cli-sdk/package.json ./packages/agent-cli-sdk/
COPY packages/agentcmd-workflows/package.json ./packages/agentcmd-workflows/
COPY apps/app/package.json ./apps/app/
COPY apps/website/package.json ./apps/website/
# Install dependencies
RUN pnpm install --frozen-lockfile
# Stage 3: Builder
FROM dependencies AS builder
# Copy source code
COPY . .
# Build all packages and app (Turborepo handles dependency order)
RUN pnpm build
# Stage 4: Runner
FROM base AS runner
# Install wget for health checks
RUN apk add --no-cache wget
# Copy production dependencies and built artifacts
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/apps/app/dist ./apps/app/dist
COPY --from=builder /app/apps/app/package.json ./apps/app/package.json
# Create data directory and set permissions
RUN mkdir -p /data && \
addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 && \
chown -R nodejs:nodejs /app /data
# Switch to non-root user
USER nodejs
# Set working directory
WORKDIR /app/apps/app
# Expose backend port
EXPOSE 4100
# Start command: run migrations then start server
CMD ["sh", "-c", "npx prisma migrate deploy --schema=./dist/prisma/schema.prisma && node dist/server/index.js"]