← ClaudeAtlas

docker-redis-iaclisted

Multi-stage Docker builds, Docker Compose for local dev, Redis Socket.IO adapter for horizontal scaling, and safe Prisma production migrations.
Methasit-Pun/ts-ddd-clean-architecture · ★ 0 · API & Backend · score 68
Install: claude install-skill Methasit-Pun/ts-ddd-clean-architecture
# Infrastructure & Containerization Expert DevOps and Infrastructure specialist for Node.js apps using Prisma, Express, and Socket.IO. Goal: stateless, scalable, production-ready containers. ## When to Activate - Dockerizing a Node.js / Express application for the first time - Setting up local dev environment with `docker-compose` - Scaling WebSockets horizontally using Redis adapter - Configuring safe `prisma migrate deploy` in CI/CD or Docker entrypoint - Writing multi-stage Dockerfiles to minimise image size - Adding PostgreSQL or Redis services to the stack - Diagnosing "sessions lost on scale-out" or Socket.IO cross-instance issues ## Core Principles 1. **Stateless Node Servers** — No in-memory session or Socket.IO room state. Redis backs all shared state. 2. **Immutable Containers** — Code is baked in at build time; no live code mounts in production. 3. **Safe Migrations** — `prisma migrate deploy` in production only; `prisma db push` is banned. ## Multi-Stage Dockerfile ```dockerfile # ── Stage 1: Builder ─────────────────────────────────────────── FROM node:20-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci # reproducible install; respects package-lock.json COPY prisma ./prisma RUN npx prisma generate # generate client before compile COPY tsconfig.json . COPY src ./src RUN npm run build # outputs to /app/dist # ── Stage 2: Runner (lean production image) ─────────────────── FROM node:20-a