Files
a7f63195ec build: base on ghcr.io/hanzoai/nodejs:v24.18.0 (Node 24 + sqlite3)
Adopt the canonical Hanzo Node base image. Node 24 uniform across the
fleet; sqlite3 bundled (node:sqlite builtin + native better-sqlite3
toolchain). One base, one way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 12:49:43 -07:00

83 lines
1.6 KiB
Docker

# Hanzo Runtime Service Dockerfile
# Build stage
FROM ghcr.io/hanzoai/nodejs:v24.18.0 AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY pnpm-lock.yaml* ./
COPY .npmrc* ./
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm build || npm run build || true
# Development stage
FROM ghcr.io/hanzoai/nodejs:v24.18.0 AS development
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy package files
COPY package*.json ./
COPY pnpm-lock.yaml* ./
COPY .npmrc* ./
# Install all dependencies (including dev)
RUN pnpm install
# Copy source code
COPY . .
# Expose port
EXPOSE 3000
# Development command with hot reload
CMD ["pnpm", "dev"]
# Production stage
FROM ghcr.io/hanzoai/nodejs:v24.18.0 AS production
WORKDIR /app
# Install runtime dependencies only
RUN apk add --no-cache tini
# Copy built application from builder
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/pnpm-lock.yaml* ./
COPY --from=builder /app/.npmrc* ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/public ./public 2>/dev/null || true
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Switch to non-root user
USER nodejs
# Expose port
EXPOSE 3000
# Use tini for proper signal handling
ENTRYPOINT ["/sbin/tini", "--"]
# Production command
CMD ["node", "dist/index.js"]
# Default to production stage
FROM production