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
| Input |
Source |
Description |
| Stack Type |
ln-730 coordinator |
frontend, backend-dotnet, backend-python |
| Versions |
Auto-detected |
Node.js, .NET, Python versions |
| Project Name |
Directory name |
Used for container naming |
| Ports |
Defaults or detected |
Frontend: 3000, Backend: 5000/8000, DB: 5432 |
Outputs
| File |
Purpose |
Template |
Dockerfile.frontend |
Frontend build & serve |
dockerfile_frontend.template |
Dockerfile.backend |
Backend build & run |
dockerfile_backend_dotnet.template or dockerfile_backend_python.template |
docker-compose.yml |
Service orchestration |
docker_compose.template |
.dockerignore |
Build context exclusions |
dockerignore.template |
nginx.conf |
Frontend proxy config |
nginx.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:
| Stack |
Templates Used |
| Frontend only |
dockerfile_frontend, nginx, dockerignore |
| Backend .NET |
dockerfile_backend_dotnet, docker_compose, dockerignore |
| Backend Python |
dockerfile_backend_python, docker_compose, dockerignore |
| Full stack .NET |
All of the above (dotnet variant) |
| Full stack Python |
All of the above (python variant) |
Phase 3: Variable Substitution
Replace template variables with detected values:
| Variable |
Source |
Example |
{{NODE_VERSION}} |
package.json engines or default |
22 |
{{DOTNET_VERSION}} |
*.csproj TargetFramework |
9.0 |
{{PYTHON_VERSION}} |
pyproject.toml or default |
3.12 |
{{PROJECT_NAME}} |
Directory name |
my-app |
{{DLL_NAME}} |
*.csproj AssemblyName |
MyApp.Api.dll |
{{FRONTEND_PORT}} |
Default or detected |
3000 |
{{BACKEND_PORT}} |
Stack-dependent |
5000 (.NET), 8000 (Python) |
{{BACKEND_HOST}} |
Service name |
backend |
{{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:
- Check if file already exists (warn before overwrite)
- Apply variable substitution
- Write file to appropriate location
- 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:
| Practice |
Implementation |
| Non-root user |
Create and use appuser (UID 1001) |
| Minimal images |
Alpine/slim variants |
| Multi-stage builds |
Exclude build tools from runtime |
| No secrets |
Use environment variables, not hardcoded |
| Health checks |
Built-in HEALTHCHECK instructions (wget/curl) |
| Specific versions |
Pin base image versions (e.g., nginx:1.27-alpine) |
| Non-interactive mode |
ARG DEBIAN_FRONTEND=noninteractive |
| Layer caching |
Copy dependency files first, source code last |
| BuildKit cache |
Use --mount=type=cache for pip |
| Python optimization |
PYTHONDONTWRITEBYTECODE=1, PYTHONUNBUFFERED=1 |
Quality Criteria
Generated files must meet:
Critical Notes
- Version Detection: Use detected versions from coordinator, not hardcoded defaults.
- Idempotent: Check file existence before writing. Warn if overwriting.
- Template-based: All generation uses templates from references/. Do NOT hardcode file contents.
- Security First: Every generated file must follow security best practices.
Reference Files
| File |
Purpose |
| dockerfile_frontend.template |
React/Vite multi-stage Dockerfile |
| dockerfile_backend_dotnet.template |
.NET multi-stage Dockerfile |
| dockerfile_backend_python.template |
Python multi-stage Dockerfile |
| docker_compose.template |
docker-compose.yml template |
| dockerignore.template |
.dockerignore template |
| nginx.template |
Nginx configuration |
Version: 1.2.0
Last Updated: 2026-01-21
1---2name: ln-731-docker-generator3description: Generates Docker and docker-compose configuration for multi-container development4license: MIT5---6
7> **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.
8
9# ln-731-docker-generator
10
11**Type:** L3 Worker
12**Category:** 7XX Project Bootstrap
13**Parent:** ln-730-devops-setup
14
15Generates production-ready Docker configuration for containerized development.
16
17---
18
19## Purpose & Scope
20
21Creates Docker infrastructure for local development and production:
22- **Does**: Generate Dockerfiles, docker-compose, .dockerignore, nginx config
23- **Does NOT**: Build images, start containers, manage deployments
24
25---
26
27## Inputs
28
29| Input | Source | Description |
30|-------|--------|-------------|
31| **Stack Type** | ln-730 coordinator | frontend, backend-dotnet, backend-python |
32| **Versions** | Auto-detected | Node.js, .NET, Python versions |
33| **Project Name** | Directory name | Used for container naming |
34| **Ports** | Defaults or detected | Frontend: 3000, Backend: 5000/8000, DB: 5432 |
35
36---
37
38## Outputs
39
40| File | Purpose | Template |
41|------|---------|----------|
42| `Dockerfile.frontend` | Frontend build & serve | [dockerfile_frontend.template](references/dockerfile_frontend.template) |
43| `Dockerfile.backend` | Backend build & run | [dockerfile_backend_dotnet.template](references/dockerfile_backend_dotnet.template) or [dockerfile_backend_python.template](references/dockerfile_backend_python.template) |
44| `docker-compose.yml` | Service orchestration | [docker_compose.template](references/docker_compose.template) |
45| `.dockerignore` | Build context exclusions | [dockerignore.template](references/dockerignore.template) |
46| `nginx.conf` | Frontend proxy config | [nginx.template](references/nginx.template) |
47
48---
49
50## Workflow
51
52### Phase 1: Input Validation
53
54Validate received configuration from coordinator:
55- Check stack type is supported (frontend, backend-dotnet, backend-python)
56- Verify versions are valid (Node 18+, .NET 8+, Python 3.10+)
57- Confirm project directory exists
58
59**Output**: Validated configuration or error
60
61### Phase 2: Template Selection
62
63Select appropriate templates based on stack:
64
65| Stack | Templates Used |
66|-------|----------------|
67| **Frontend only** | dockerfile_frontend, nginx, dockerignore |
68| **Backend .NET** | dockerfile_backend_dotnet, docker_compose, dockerignore |
69| **Backend Python** | dockerfile_backend_python, docker_compose, dockerignore |
70| **Full stack .NET** | All of the above (dotnet variant) |
71| **Full stack Python** | All of the above (python variant) |
72
73### Phase 3: Variable Substitution
74
75Replace template variables with detected values:
76
77| Variable | Source | Example |
78|----------|--------|---------|
79| `{{NODE_VERSION}}` | package.json engines or default | 22 |
80| `{{DOTNET_VERSION}}` | *.csproj TargetFramework | 9.0 |
81| `{{PYTHON_VERSION}}` | pyproject.toml or default | 3.12 |
82| `{{PROJECT_NAME}}` | Directory name | my-app |
83| `{{DLL_NAME}}` | *.csproj AssemblyName | MyApp.Api.dll |
84| `{{FRONTEND_PORT}}` | Default or detected | 3000 |
85| `{{BACKEND_PORT}}` | Stack-dependent | 5000 (.NET), 8000 (Python) |
86| `{{BACKEND_HOST}}` | Service name | backend |
87| `{{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) |
88
89### Phase 4: File Generation
90
91Generate files from templates:
921. Check if file already exists (warn before overwrite)
932. Apply variable substitution
943. Write file to appropriate location
954. Validate syntax where possible
96
97**File Locations**:
98- `Dockerfile.frontend` -> `src/frontend/Dockerfile`
99- `Dockerfile.backend` -> project root
100- `docker-compose.yml` -> project root
101- `.dockerignore` -> project root
102- `nginx.conf` -> `src/frontend/nginx.conf`
103
104---
105
106## Supported Stacks
107
108### Frontend: React/Vite + Nginx
109
110**Requirements**:
111- package.json with build script
112- Vite or CRA configuration
113
114**Generated**:
115- Multi-stage Dockerfile (builder + nginx)
116- Nginx config with SPA routing and API proxy
117
118### Backend: .NET 8/9
119
120**Requirements**:
121- *.sln file in root
122- *.csproj with TargetFramework
123
124**Generated**:
125- Multi-stage Dockerfile (SDK build + ASP.NET runtime)
126- Health check endpoint configuration
127
128### Backend: Python (FastAPI/Django)
129
130**Requirements**:
131- requirements.txt or pyproject.toml
132
133**Generated**:
134- Multi-stage Dockerfile (builder + slim runtime)
135- uvicorn (FastAPI) or gunicorn (Django) entrypoint
136
137---
138
139## Security & Performance Best Practices
140
141All generated files follow these guidelines:
142
143| Practice | Implementation |
144|----------|----------------|
145| **Non-root user** | Create and use appuser (UID 1001) |
146| **Minimal images** | Alpine/slim variants |
147| **Multi-stage builds** | Exclude build tools from runtime |
148| **No secrets** | Use environment variables, not hardcoded |
149| **Health checks** | Built-in HEALTHCHECK instructions (wget/curl) |
150| **Specific versions** | Pin base image versions (e.g., nginx:1.27-alpine) |
151| **Non-interactive mode** | ARG DEBIAN_FRONTEND=noninteractive |
152| **Layer caching** | Copy dependency files first, source code last |
153| **BuildKit cache** | Use `--mount=type=cache` for pip |
154| **Python optimization** | PYTHONDONTWRITEBYTECODE=1, PYTHONUNBUFFERED=1 |
155
156---
157
158## Quality Criteria
159
160Generated files must meet:
161- [ ] `docker-compose config` validates without errors
162- [ ] All base images use specific versions (not `latest`)
163- [ ] Non-root user configured in all Dockerfiles
164- [ ] Health checks present for all services
165- [ ] .dockerignore excludes all sensitive files
166- [ ] No hardcoded secrets or passwords
167
168---
169
170## Critical Notes
171
1721. **Version Detection**: Use detected versions from coordinator, not hardcoded defaults.
1732. **Idempotent**: Check file existence before writing. Warn if overwriting.
1743. **Template-based**: All generation uses templates from references/. Do NOT hardcode file contents.
1754. **Security First**: Every generated file must follow security best practices.
176
177---
178
179## Reference Files
180
181| File | Purpose |
182|------|---------|
183| [dockerfile_frontend.template](references/dockerfile_frontend.template) | React/Vite multi-stage Dockerfile |
184| [dockerfile_backend_dotnet.template](references/dockerfile_backend_dotnet.template) | .NET multi-stage Dockerfile |
185| [dockerfile_backend_python.template](references/dockerfile_backend_python.template) | Python multi-stage Dockerfile |
186| [docker_compose.template](references/docker_compose.template) | docker-compose.yml template |
187| [dockerignore.template](references/dockerignore.template) | .dockerignore template |
188| [nginx.template](references/nginx.template) | Nginx configuration |
189
190---
191
192**Version:** 1.2.0
193**Last Updated:** 2026-01-21