Get the FREE Ultimate OpenClaw Setup Guide →

ln-731-docker-generator

Use Caution
npx machina-cli add skill levnikolaevich/claude-code-skills/ln-731-docker-generator --openclaw
Files (1)
SKILL.md
6.7 KB

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-731-docker-generator

Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-730-devops-setup

Generates production-ready Docker configuration for containerized development.


Purpose & Scope

Creates Docker infrastructure for local development and production:

  • Does: Generate Dockerfiles, docker-compose, .dockerignore, nginx config
  • Does NOT: Build images, start containers, manage deployments

Inputs

InputSourceDescription
Stack Typeln-730 coordinatorfrontend, backend-dotnet, backend-python
VersionsAuto-detectedNode.js, .NET, Python versions
Project NameDirectory nameUsed for container naming
PortsDefaults or detectedFrontend: 3000, Backend: 5000/8000, DB: 5432

Outputs

FilePurposeTemplate
Dockerfile.frontendFrontend build & servedockerfile_frontend.template
Dockerfile.backendBackend build & rundockerfile_backend_dotnet.template or dockerfile_backend_python.template
docker-compose.ymlService orchestrationdocker_compose.template
.dockerignoreBuild context exclusionsdockerignore.template
nginx.confFrontend proxy confignginx.template

Workflow

Phase 1: Input Validation

Validate received configuration from coordinator:

  • Check stack type is supported (frontend, backend-dotnet, backend-python)
  • Verify versions are valid (Node 18+, .NET 8+, Python 3.10+)
  • Confirm project directory exists

Output: Validated configuration or error

Phase 2: Template Selection

Select appropriate templates based on stack:

StackTemplates Used
Frontend onlydockerfile_frontend, nginx, dockerignore
Backend .NETdockerfile_backend_dotnet, docker_compose, dockerignore
Backend Pythondockerfile_backend_python, docker_compose, dockerignore
Full stack .NETAll of the above (dotnet variant)
Full stack PythonAll of the above (python variant)

Phase 3: Variable Substitution

Replace template variables with detected values:

VariableSourceExample
{{NODE_VERSION}}package.json engines or default22
{{DOTNET_VERSION}}*.csproj TargetFramework9.0
{{PYTHON_VERSION}}pyproject.toml or default3.12
{{PROJECT_NAME}}Directory namemy-app
{{DLL_NAME}}*.csproj AssemblyNameMyApp.Api.dll
{{FRONTEND_PORT}}Default or detected3000
{{BACKEND_PORT}}Stack-dependent5000 (.NET), 8000 (Python)
{{BACKEND_HOST}}Service namebackend
{{CMD}}Framework-dependent["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] (FastAPI) or ["gunicorn", "--bind", "0.0.0.0:8000", "{{PROJECT_NAME}}.wsgi:application"] (Django)

Phase 4: File Generation

Generate files from templates:

  1. Check if file already exists (warn before overwrite)
  2. Apply variable substitution
  3. Write file to appropriate location
  4. Validate syntax where possible

File Locations:

  • Dockerfile.frontend -> src/frontend/Dockerfile
  • Dockerfile.backend -> project root
  • docker-compose.yml -> project root
  • .dockerignore -> project root
  • nginx.conf -> src/frontend/nginx.conf

Supported Stacks

Frontend: React/Vite + Nginx

Requirements:

  • package.json with build script
  • Vite or CRA configuration

Generated:

  • Multi-stage Dockerfile (builder + nginx)
  • Nginx config with SPA routing and API proxy

Backend: .NET 8/9

Requirements:

  • *.sln file in root
  • *.csproj with TargetFramework

Generated:

  • Multi-stage Dockerfile (SDK build + ASP.NET runtime)
  • Health check endpoint configuration

Backend: Python (FastAPI/Django)

Requirements:

  • requirements.txt or pyproject.toml

Generated:

  • Multi-stage Dockerfile (builder + slim runtime)
  • uvicorn (FastAPI) or gunicorn (Django) entrypoint

Security & Performance Best Practices

All generated files follow these guidelines:

PracticeImplementation
Non-root userCreate and use appuser (UID 1001)
Minimal imagesAlpine/slim variants
Multi-stage buildsExclude build tools from runtime
No secretsUse environment variables, not hardcoded
Health checksBuilt-in HEALTHCHECK instructions (wget/curl)
Specific versionsPin base image versions (e.g., nginx:1.27-alpine)
Non-interactive modeARG DEBIAN_FRONTEND=noninteractive
Layer cachingCopy dependency files first, source code last
BuildKit cacheUse --mount=type=cache for pip
Python optimizationPYTHONDONTWRITEBYTECODE=1, PYTHONUNBUFFERED=1

Quality Criteria

Generated files must meet:

  • docker-compose config validates without errors
  • All base images use specific versions (not latest)
  • Non-root user configured in all Dockerfiles
  • Health checks present for all services
  • .dockerignore excludes all sensitive files
  • No hardcoded secrets or passwords

Critical Notes

  1. Version Detection: Use detected versions from coordinator, not hardcoded defaults.
  2. Idempotent: Check file existence before writing. Warn if overwriting.
  3. Template-based: All generation uses templates from references/. Do NOT hardcode file contents.
  4. Security First: Every generated file must follow security best practices.

Reference Files

FilePurpose
dockerfile_frontend.templateReact/Vite multi-stage Dockerfile
dockerfile_backend_dotnet.template.NET multi-stage Dockerfile
dockerfile_backend_python.templatePython multi-stage Dockerfile
docker_compose.templatedocker-compose.yml template
dockerignore.template.dockerignore template
nginx.templateNginx configuration

Version: 1.2.0 Last Updated: 2026-01-21

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-731-docker-generator/SKILL.mdView on GitHub

Overview

ln-731-docker-generator creates production-ready Docker infrastructure for local development and production. It outputs Dockerfiles, docker-compose, .dockerignore, and nginx config tailored to frontend/backend stacks, without building images or starting containers.

How This Skill Works

The tool validates inputs (stack type, versions, project directory), selects the appropriate templates, and substitutes variables like {{PROJECT_NAME}} and {{FRONTEND_PORT}}. It then generates files such as Dockerfile.frontend, Dockerfile.backend, docker-compose.yml, .dockerignore, and nginx.conf from the referenced templates.

When to Use It

  • Setting up a new project with a frontend and backend stack to run in containers
  • Generating production-ready Docker and nginx config for multi-service apps
  • Regenerating templates after changing project name or ports
  • Previewing the exact files that will be created before running builds
  • Migrating from a single service to a full-stack docker-compose setup

Quick Start

  1. Step 1: Choose a Stack Type (frontend, backend-dotnet, or backend-python)
  2. Step 2: Run the generator to produce Dockerfile.frontend, Dockerfile.backend, docker-compose.yml, .dockerignore, nginx.conf
  3. Step 3: Review and customize {{PROJECT_NAME}} and port values in the generated files

Best Practices

  • Verify stack type is supported (frontend, backend-dotnet, backend-python) before generating
  • Keep the PROJECT_NAME consistent to ensure predictable container names
  • Check detected versions (Node, .NET, Python) to ensure compatibility with templates
  • Review nginx.conf for proxy rules and routes before commit
  • Remember this tool only generates config; it does not build images or start containers

Example Use Cases

  • Dev setup for a React frontend with a .NET backend and nginx proxy
  • Python backend with a frontend served behind nginx including docker-compose
  • Project bootstrapping: generate Dockerfiles and docker-compose from a single repo
  • CI-ready docker templates that omit local builds and runs
  • Port-aware generation: frontend 3000, backend 5000/8000, DB 5432 as defaults

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers