docker-patterns
SolidDockerfile 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
Quality Score: 82/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
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
DevOps & Infrastructure Listed
docker-patterns
Docker and Docker Compose patterns for local development, container security, networking, volume strategies, and multi-service orchestration.
0 Updated yesterday
TeiNam DevOps & Infrastructure Listed
docker-patterns
Docker and Docker Compose patterns for local development, container security, networking, volume strategies, and multi-service orchestration.
0 Updated 1 months ago
lhbsaa DevOps & Infrastructure Listed
docker-deployment
Production-ready Docker configurations, multi-stage builds, and deployment best practices
7 Updated 1 months ago
pfangueiro