This skill provides implementation details for using Docker AI Agent (Gordon) to create and optimize Dockerfiles for Next.js and FastAPI applications, with fallback to standard best-practice Dockerfiles when Gordon is unavailable.
Capabilities
Generate multi-stage Dockerfiles for Next.js applications
Create optimized Dockerfiles for FastAPI applications using python-slim base
Implement proper file copying with only necessary files for efficient builds
Include healthchecks and proper port exposure (3000 & 8000)
Use uv or pip for dependency installation with best practices
Fallback to standard best-practice Dockerfiles when Gordon is unavailable
Implementation Details
Next.js Dockerfile Generation
Use multi-stage build pattern for optimized images
Copy only necessary files in each stage to leverage Docker layer caching
Use appropriate Node.js base image optimized for production
Install dependencies in a separate layer from application code
Build application in build stage and copy to production stage
Expose port 3000 for Next.js applications
Include healthcheck for container monitoring
FastAPI Dockerfile Generation
Use python-slim base image for minimal footprint
Install dependencies using uv or pip with optimization flags
Set up proper working directory and user permissions
Copy requirements first to leverage Docker layer caching
Install uvicorn for ASGI server functionality
Expose port 8000 for FastAPI applications
Include healthcheck for container monitoring
Healthcheck Implementation
Implement proper healthcheck commands for both application types
Use appropriate endpoints or commands to verify application health
Set reasonable timeouts and intervals for healthchecks
Fallback Mechanism
If Gordon Docker AI Agent is unavailable, generate standard best-practice Dockerfiles
Follow industry-standard patterns for containerization
Ensure security and performance best practices in fallback implementations
Usage
For Next.js Applications:
# Multi-stage build example
FROM node:18-alpine AS deps
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN npm ci --only=production
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
HEALTHCHECK CMD curl --fail http://localhost:3000/api/health || exit 1
CMD ["node", "server.js"]
For FastAPI Applications:
FROM python:3.11-slim AS base
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app
FROM base AS deps
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
FROM base AS runtime
COPY --from=deps /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY . .
EXPOSE 8000
HEALTHCHECK CMD curl --fail http://localhost:8000/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
1---2name: gordon-dockerfile-generator3description: Gordon Dockerfile Generator Skill4---5# Gordon Dockerfile Generator Skill67## Purpose8This skill provides implementation details for using Docker AI Agent (Gordon) to create and optimize Dockerfiles for Next.js and FastAPI applications, with fallback to standard best-practice Dockerfiles when Gordon is unavailable.910## Capabilities11- Generate multi-stage Dockerfiles for Next.js applications12- Create optimized Dockerfiles for FastAPI applications using python-slim base13- Implement proper file copying with only necessary files for efficient builds14- Include healthchecks and proper port exposure (3000 & 8000)15- Use uv or pip for dependency installation with best practices16- Fallback to standard best-practice Dockerfiles when Gordon is unavailable1718## Implementation Details1920### Next.js Dockerfile Generation21- Use multi-stage build pattern for optimized images22- Copy only necessary files in each stage to leverage Docker layer caching23- Use appropriate Node.js base image optimized for production24- Install dependencies in a separate layer from application code25- Build application in build stage and copy to production stage26- Expose port 3000 for Next.js applications27- Include healthcheck for container monitoring2829### FastAPI Dockerfile Generation30- Use python-slim base image for minimal footprint31- Install dependencies using uv or pip with optimization flags32- Set up proper working directory and user permissions33- Copy requirements first to leverage Docker layer caching34- Install uvicorn for ASGI server functionality35- Expose port 8000 for FastAPI applications36- Include healthcheck for container monitoring3738### Healthcheck Implementation39- Implement proper healthcheck commands for both application types40- Use appropriate endpoints or commands to verify application health41- Set reasonable timeouts and intervals for healthchecks4243### Fallback Mechanism44- If Gordon Docker AI Agent is unavailable, generate standard best-practice Dockerfiles45- Follow industry-standard patterns for containerization46- Ensure security and performance best practices in fallback implementations4748## Usage4950### For Next.js Applications:51```dockerfile52# Multi-stage build example53FROM node:18-alpine AS deps54WORKDIR /app55COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./56RUN npm ci --only=production5758FROM node:18-alpine AS builder59WORKDIR /app60COPY --from=deps /app/node_modules ./node_modules61COPY . .62RUN npm run build6364FROM node:18-alpine AS runner65WORKDIR /app66ENV NODE_ENV production67COPY --from=builder /app/public ./public68COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./69COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static70USER nextjs71EXPOSE 300072HEALTHCHECK CMD curl --fail http://localhost:3000/api/health || exit 173CMD ["node", "server.js"]74```7576### For FastAPI Applications:77```dockerfile78FROM python:3.11-slim AS base79WORKDIR /app80ENV PYTHONDONTWRITEBYTECODE=1 \81 PYTHONUNBUFFERED=1 \82 PYTHONPATH=/app8384FROM base AS deps85COPY requirements.txt .86RUN pip install --no-cache-dir --upgrade pip && \87 pip install --no-cache-dir -r requirements.txt8889FROM base AS runtime90COPY --from=deps /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages91COPY . .92EXPOSE 800093HEALTHCHECK CMD curl --fail http://localhost:8000/health || exit 194CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]95```
Run npx skillmds@latest add sarimofficial/gordon-dockerfile-generator in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Gordon Dockerfile Generator Skill It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
sarimofficial (@sarimofficial) published this skill. Their other Agent Skills are listed on their SkillMD profile.