with one click
adding-docker
Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.
Menu
Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.
| name | adding-docker |
| description | Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore. |
Use this skill when the user asks to dockerize, containerize, or add Docker support to an application.
Detect the runtime — inspect package.json, requirements.txt, go.mod, Cargo.toml, etc. to determine the language and runtime.
Create a multi-stage Dockerfile
For Node.js (example):
FROM node:20-alpine AS base
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
FROM base AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/package.json ./
EXPOSE 3000
CMD ["npm", "start"]
Adapt for the detected framework — adjust the build output directory, entry command, and base image.
Create .dockerignore
node_modules
.next
.git
.env*
*.md
Create docker-compose.yml (if the app has dependencies like a database or Redis):
services:
app:
build: .
ports:
- "3000:3000"
env_file: .env
depends_on:
- db
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Add npm scripts (optional)
{
"docker:build": "docker build -t myapp .",
"docker:run": "docker compose up"
}
.env files into the image — use env_file or runtime injection..dockerignore that excludes sibling packages not needed by the target app.HEALTHCHECK instruction for production deployments.Generate or edit images using the OpenAI Image API (gpt-image-2). Use when the user asks to generate, create, draw, render, illustrate, mock up, or edit an image, icon, logo, mockup, illustration, OG image, blog hero, marketing asset, or similar visual. Also use when the user supplies a reference image and asks to modify, restyle, or remix it. Triggers on: "generate an image", "create an image", "make a picture of", "edit this image", "restyle this", "make a mockup of", "draw a", "render a", "illustration of".
When the same multi-step workflow repeats in Cursor (user corrections or agent redos), capture it as a new SKILL.md under .cursor/skills/ so future sessions load it automatically.
After navigating and interacting in Cursor's built-in browser, use browser_network_requests to audit every fetch/XHR for failures, slowness, duplicate calls, and suspicious payloads. Use for API-heavy pages and after backend or client networking changes.
When GitHub Actions fails, fetch failing job logs and assign each failing job to a separate subagent that fixes its slice of the problem in parallel. Use for multi-job CI failures where jobs are independent.
Run four parallel read-only subagents that each review the same diff from a different lens — security, performance, correctness, and readability — then merge findings into one report. Use before merging large or risky PRs.
Execute a user flow step-by-step in Cursor's built-in browser while documenting each action, then emit a Playwright test that replays the same flow using stable selectors derived from the accessibility tree.