Skip to content

Commit 749f7a2

Browse files
Alex Holmbergclaude
authored andcommitted
fix: convert service Dockerfiles to multi-stage builds for ARM64 compatibility
Add python3 and build-essential in builder stage so better-sqlite3 can compile from source when ARM64 prebuilt binaries fail. Production image remains slim with only dumb-init and wget. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8462699 commit 749f7a2

3 files changed

Lines changed: 81 additions & 12 deletions

File tree

tests/ag-ui-app/services/contact-intelligence/Dockerfile

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# Using Debian slim for better native module compatibility
44
# =============================================================================
55

6-
FROM node:20-slim
6+
FROM node:20-slim AS builder
77

8-
# Install dumb-init for proper signal handling
8+
# Install build dependencies for native modules (better-sqlite3)
99
RUN apt-get update && apt-get install -y --no-install-recommends \
10-
dumb-init \
11-
wget \
10+
python3 \
11+
build-essential \
1212
&& rm -rf /var/lib/apt/lists/*
1313

1414
WORKDIR /app
@@ -26,6 +26,29 @@ RUN pnpm install --frozen-lockfile
2626
COPY . .
2727
RUN pnpm build
2828

29+
# =============================================================================
30+
# Production stage - minimal runtime image
31+
# =============================================================================
32+
FROM node:20-slim
33+
34+
# Install runtime dependencies only
35+
RUN apt-get update && apt-get install -y --no-install-recommends \
36+
dumb-init \
37+
wget \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
WORKDIR /app
41+
42+
# Enable pnpm for runtime
43+
RUN corepack enable pnpm
44+
45+
# Copy package files
46+
COPY package.json pnpm-lock.yaml* .npmrc* ./
47+
48+
# Copy built artifacts and node_modules from builder
49+
COPY --from=builder /app/dist ./dist
50+
COPY --from=builder /app/node_modules ./node_modules
51+
2952
# Create non-root user for security
3053
RUN groupadd --system --gid 1001 nodejs && \
3154
useradd --system --uid 1001 --gid nodejs appuser && \

tests/ag-ui-app/services/sentiment-analysis/Dockerfile

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# Using Debian slim for better native module compatibility
44
# =============================================================================
55

6-
FROM node:20-slim
6+
FROM node:20-slim AS builder
77

8-
# Install dumb-init for proper signal handling
8+
# Install build dependencies for native modules (better-sqlite3)
99
RUN apt-get update && apt-get install -y --no-install-recommends \
10-
dumb-init \
11-
wget \
10+
python3 \
11+
build-essential \
1212
&& rm -rf /var/lib/apt/lists/*
1313

1414
WORKDIR /app
@@ -26,6 +26,29 @@ RUN pnpm install --frozen-lockfile
2626
COPY . .
2727
RUN pnpm build
2828

29+
# =============================================================================
30+
# Production stage - minimal runtime image
31+
# =============================================================================
32+
FROM node:20-slim
33+
34+
# Install runtime dependencies only
35+
RUN apt-get update && apt-get install -y --no-install-recommends \
36+
dumb-init \
37+
wget \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
WORKDIR /app
41+
42+
# Enable pnpm for runtime
43+
RUN corepack enable pnpm
44+
45+
# Copy package files
46+
COPY package.json pnpm-lock.yaml* .npmrc* ./
47+
48+
# Copy built artifacts and node_modules from builder
49+
COPY --from=builder /app/dist ./dist
50+
COPY --from=builder /app/node_modules ./node_modules
51+
2952
# Create non-root user for security
3053
RUN groupadd --system --gid 1001 nodejs && \
3154
useradd --system --uid 1001 --gid nodejs appuser && \

tests/ag-ui-app/services/writing-style/Dockerfile

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# Using Debian slim for better native module compatibility
44
# =============================================================================
55

6-
FROM node:20-slim
6+
FROM node:20-slim AS builder
77

8-
# Install dumb-init for proper signal handling
8+
# Install build dependencies for native modules (better-sqlite3)
99
RUN apt-get update && apt-get install -y --no-install-recommends \
10-
dumb-init \
11-
wget \
10+
python3 \
11+
build-essential \
1212
&& rm -rf /var/lib/apt/lists/*
1313

1414
WORKDIR /app
@@ -26,6 +26,29 @@ RUN pnpm install --frozen-lockfile
2626
COPY . .
2727
RUN pnpm build
2828

29+
# =============================================================================
30+
# Production stage - minimal runtime image
31+
# =============================================================================
32+
FROM node:20-slim
33+
34+
# Install runtime dependencies only
35+
RUN apt-get update && apt-get install -y --no-install-recommends \
36+
dumb-init \
37+
wget \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
WORKDIR /app
41+
42+
# Enable pnpm for runtime
43+
RUN corepack enable pnpm
44+
45+
# Copy package files
46+
COPY package.json pnpm-lock.yaml* .npmrc* ./
47+
48+
# Copy built artifacts and node_modules from builder
49+
COPY --from=builder /app/dist ./dist
50+
COPY --from=builder /app/node_modules ./node_modules
51+
2952
# Create non-root user for security
3053
RUN groupadd --system --gid 1001 nodejs && \
3154
useradd --system --uid 1001 --gid nodejs appuser && \

0 commit comments

Comments
 (0)