docker-patterns

Solid

Dockerfile best practices, multi-stage builds, docker-compose for dev/prod. Use when setting up containerization for a NestJS backend or Next.js frontend, or configuring a local dev environment with docker-compose.

Web & Frontend 30 stars 9 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
50
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Docker Patterns ## NestJS Multi-Stage Dockerfile ```dockerfile # Dockerfile (backend) # syntax=docker/dockerfile:1.5 FROM node:22-alpine AS base WORKDIR /app # Install only production deps in base RUN corepack enable # ─── deps stage ────────────────────────────────────────────── FROM base AS deps COPY package.json pnpm-lock.yaml ./ RUN --mount=type=cache,target=/root/.local/share/pnpm/store \ pnpm install --frozen-lockfile # ─── build stage ───────────────────────────────────────────── FROM deps AS build COPY . . RUN pnpm run build # ─── production stage ──────────────────────────────────────── FROM base AS production ENV NODE_ENV=production # Create non-root user RUN addgroup --system --gid 1001 nodejs && \ adduser --system --uid 1001 nestjs # Copy only what's needed to run COPY --from=deps --chown=nestjs:nodejs /app/node_modules ./node_modules COPY --from=build --chown=nestjs:nodejs /app/dist ./dist COPY --from=build --chown=nestjs:nodejs /app/package.json ./package.json USER nestjs EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ CMD wget -qO- http://localhost:3000/health/liveness || exit 1 CMD ["node", "dist/main"] ``` ## Next.js Multi-Stage Dockerfile ```dockerfile # Dockerfile (frontend) # syntax=docker/dockerfile:1.5 FROM node:22-alpine AS base RUN corepack enable && apk add --no-cache libc6-compat WORKDIR /app # ─── deps ──────────────────────────────────────────────────── FROM base AS deps COPY package.json pnpm-l...

Details

Author
sabahattink
Repository
sabahattink/antigravity-fullstack-hq
Created
8 months ago
Last Updated
5 days ago
Language
PowerShell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category