AgentStack
SKILL verified MIT Self-run

Docker Patterns

skill-besync-labs-antigravity-ai-kit-docker-patterns · by besync-labs

Docker and containerization best practices

No reviews yet
0 installs
19 views
0.0% view→install

Install

$ agentstack add skill-besync-labs-antigravity-ai-kit-docker-patterns

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Docker Patterns? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Docker Patterns Skill

> Purpose: Apply Docker best practices for containerization


Overview

This skill provides patterns for building efficient, secure Docker images and orchestrating containers.


Dockerfile Best Practices

Multi-Stage Build

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Production stage
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
USER node
EXPOSE 3000
CMD ["node", "dist/main.js"]

Layer Optimization

# ❌ Bad - cache invalidated on any file change
COPY . .
RUN npm install

# ✅ Good - dependencies cached separately
COPY package*.json ./
RUN npm ci
COPY . .

Security

Non-Root User

# Create non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser

Minimal Base Image

# ✅ Use alpine variants
FROM node:20-alpine

# ✅ Or distroless
FROM gcr.io/distroless/nodejs20-debian12

Docker Compose

Development Setup

version: "3.8"

services:
  app:
    build:
      context: .
      target: development
    volumes:
      - .:/app
      - /app/node_modules
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=development
    depends_on:
      - db
      - redis

  db:
    image: postgres:16-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: app_dev
    ports:
      - "5432:5432"

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"

volumes:
  postgres_data:

Health Checks

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1

.dockerignore

node_modules
npm-debug.log
.git
.env
.env.*
dist
coverage
.DS_Store
*.md
!README.md

Quick Reference

| Pattern | Purpose | | :------------ | :---------------- | | Multi-stage | Smaller images | | Alpine base | Minimal footprint | | Non-root user | Security | | Layer caching | Faster builds | | Health checks | Orchestration | | .dockerignore | Exclude files | | Compose | Local development |

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.