본문으로 건너뛰기
cccskills
무료GitHub에 공개

docker-patterns

Apply Docker and Docker Compose best practices for containerising services. Use when writing or reviewing Dockerfiles and compose configs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구DockerPostgreSQL
설치 방법 보기

포함된 파일(1)

  • SKILL.md2.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

SKILL: Docker Patterns

Multi-Stage Dockerfile Pattern

# syntax=docker/dockerfile:1
FROM node:22-alpine AS base
WORKDIR /app

FROM base AS deps
COPY package*.json ./
RUN --mount=type=cache,target=/root/.npm \
    npm ci --only=production

FROM base AS dev-deps
COPY package*.json ./
RUN --mount=type=cache,target=/root/.npm \
    npm ci

FROM base AS build
COPY --from=dev-deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

FROM gcr.io/distroless/nodejs22-debian12 AS production
WORKDIR /app
USER 1001
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
EXPOSE 3000
CMD ["dist/main.js"]

docker-compose Health Check Pattern

services:
  app:
    build:
      context: .
      target: production
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgres://postgres:pass@db:5432/app
    depends_on:
      db:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
      interval: 5s
      timeout: 5s
      retries: 5
      start_period: 10s

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_PASSWORD: pass
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 2s
      timeout: 5s
      retries: 10

.dockerignore

node_modules
.git
.github
dist
build
coverage
.next
*.log
.env*
!.env.example
README.md
docs
tests

Key Rules

  • ALWAYS use multi-stage builds for production images.
  • ALWAYS run as non-root user (USER 1001 or named user).
  • ALWAYS add health checks to all services.
  • NEVER copy .env files into images.
  • Use --mount=type=cache for package manager caches.
  • Use distroless or alpine base images.
  • Use docker compose up -d --wait to wait for health checks.

Verification

# Build test
docker build --target production -t test-image .

# Security scan
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  aquasec/trivy:latest image test-image

# Start and verify health
docker compose up -d --wait
docker compose ps

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Run WCAG 2.2 Level AA accessibility audits against generated UI. Use when a story has ui:true or when asked to audit accessibility.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

Generate a complete component file tree wired to design tokens with tests and Gherkin spec. Use when scaffolding a new UI component.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

Extract Gherkin scenarios from story markdown files into runnable .feature files and generate step definition stubs. Use when syncing stories to test suites.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

Read and write design tokens in W3C DTCG format (tokens.json) and emit CSS, Tailwind, and Mantine outputs. Use when modifying or generating design tokens.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

Identify and annotate cloud cost implications of architectural decisions. Use when reviewing infrastructure changes or designing new services.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

gh-issues

무료

Create, read, update, and link GitHub Issues as story artifacts throughout the story lifecycle. Use when managing issues for stories.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kinncj/Heimdall702026년 9월 2일 업데이트

kinncj의 스킬 모두 보기

이 스킬의 문제 신고