managarten/services/matrix-ollama-bot/Dockerfile
Till-JS 53653743f0 fix(matrix-bots): add --ignore-scripts to Dockerfiles
Skip postinstall scripts for matrix-sdk-crypto-nodejs which
doesn't build on Alpine Linux. E2E encryption not needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 12:42:11 +01:00

53 lines
1.2 KiB
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
# Copy package files
COPY package.json pnpm-lock.yaml* ./
# Install dependencies (ignore optional native modules)
RUN pnpm install --frozen-lockfile --ignore-scripts || pnpm install --ignore-scripts
# Copy source
COPY . .
# Build
RUN pnpm build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
# Create data directory for bot storage
RUN mkdir -p /app/data
# Copy package files
COPY package.json pnpm-lock.yaml* ./
# Install production dependencies only (ignore optional native modules)
RUN pnpm install --prod --frozen-lockfile --ignore-scripts || pnpm install --prod --ignore-scripts
# Copy built files
COPY --from=builder /app/dist ./dist
# Create non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nestjs
RUN chown -R nestjs:nodejs /app
USER nestjs
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3311/health || exit 1
EXPOSE 3311
CMD ["node", "dist/main.js"]