xiaohongshu
xiaohongshu
app-docker-deploy-with-traefik
Generate Docker and Traefik deployment configurations for any application (Node.js, Python, Go, Rust, Java). Creates Dockerfile, docker-compose.yml, docker-compose.for-traefik.yml overlay, and .env.sample with production best practices. Use when: dockerize app, containerize, add Docker, deploy wi...
Full skill instructions
Generate production-ready Docker deployment configurations with Traefik reverse proxy integration, automatic HTTPS via Let's Encrypt.
This skill creates a deployment configuration following a proven pattern:
Before generating configurations, understand the project:
Detect the project type by examining:
package.json → Node.js/TypeScriptrequirements.txt / pyproject.toml / Pipfile → Pythongo.mod → GoCargo.toml → Rustpom.xml / build.gradle → JavaIdentify the application port from:
Check for existing Docker files - Don't overwrite without asking
Create a multi-stage Dockerfile appropriate for the project type. See DOCKERFILES.md for templates.
Key principles:
:latest)Base configuration with:
./data/<service>:/path)${VARIABLE})unless-stoppedservices:
app:
build: .
restart: unless-stopped
volumes:
- ./data/app:/app/data
environment:
- NODE_ENV=${NODE_ENV}
- PORT=${PORT}
depends_on:
- db
labels:
- 'com.centurylinklabs.watchtower.enable=true'
- 'com.centurylinklabs.watchtower.scope=${WATCHTOWER_SCOPE}'
db:
image: postgres:17-alpine
restart: unless-stopped
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
healthcheck:
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
interval: 10s
timeout: 2s
retries: 10
Traefik overlay that can be composed with the base file:
services:
app:
networks:
- default
- traefik
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=traefik'
# Service (internal port)
- 'traefik.http.services.${SERVICE_NAME}.loadbalancer.server.port=${PORT}'
# HTTPS Router
- 'traefik.http.routers.${SERVICE_NAME}.rule=Host(`${DOMAIN}`)'
- 'traefik.http.routers.${SERVICE_NAME}.entrypoints=websecure'
- 'traefik.http.routers.${SERVICE_NAME}.tls=true'
- 'traefik.http.routers.${SERVICE_NAME}.tls.certResolver=webcert'
- 'traefik.http.routers.${SERVICE_NAME}.service=${SERVICE_NAME}'
db:
networks:
- default
networks:
traefik:
external: true
Template for required environment variables:
# Domain and Deployment
DOMAIN=myapp.example.com
PORT=3000
# Database
POSTGRES_DB=myapp
POSTGRES_USER=myapp
POSTGRES_PASSWORD=change-me-in-production
# Application
NODE_ENV=production
# Auto-updates (optional)
WATCHTOWER_SCOPE=myapp
Include in the output:
# Development (without Traefik)
docker compose up -d
# Production (with Traefik)
docker compose -f docker-compose.yml -f docker-compose.for-traefik.yml up -d
# Create external traefik network (first time only)
docker network create traefik
| Label | Purpose |
|---|---|
traefik.enable=true | Enable Traefik routing for this container |
traefik.docker.network=traefik | Specify which network Traefik should use |
traefik.http.services.NAME.loadbalancer.server.port=PORT | Container's internal port |
traefik.http.routers.NAME.rule=Host(\domain`)` | Domain routing rule |
traefik.http.routers.NAME.entrypoints=websecure | Use HTTPS entrypoint |
traefik.http.routers.NAME.tls=true | Enable TLS |
traefik.http.routers.NAME.tls.certResolver=webcert | Use Let's Encrypt |
traefik.http.routers.NAME.service=NAME | Link router to service |
For admin panels or protected routes:
labels:
# Define middleware
- 'traefik.http.middlewares.myapp-auth.basicauth.users=${USERNAME}:${HASHED_PASSWORD}'
# Apply to router
- 'traefik.http.routers.myapp.middlewares=myapp-auth@docker'
Generate password hash: htpasswd -nb username password
# API subdomain
- 'traefik.http.routers.myapp-api.rule=Host(`api.${DOMAIN}`)'
- 'traefik.http.routers.myapp-api.entrypoints=websecure'
- 'traefik.http.routers.myapp-api.tls=true'
- 'traefik.http.routers.myapp-api.tls.certResolver=webcert'
- 'traefik.http.routers.myapp-api.service=myapp'
:latest in productionLocated in the scripts/ directory:
Generate password hashes for Traefik basic auth:
./scripts/generate-htpasswd.sh admin mypassword
Validate docker-compose files for common issues:
python scripts/validate-compose.py docker-compose.yml docker-compose.for-traefik.yml
Requires: pip install pyyaml
Check if the traefik network exists (and optionally create it):
./scripts/check-network.sh # Check only
./scripts/check-network.sh --create # Create if missing
Located in the templates/ directory. Copy and customize:
| Template | Description |
|---|---|
Dockerfile.node | Node.js multi-stage build |
Dockerfile.python | Python with uv package manager |
docker-compose.yml | Base compose with app + PostgreSQL |
docker-compose.for-traefik.yml | Traefik routing overlay |
.dockerignore | Optimized Docker build context |
.env.sample | Environment variables template |
Replace placeholders: {{SERVICE_NAME}}, {{PORT}}, {{NODE_VERSION}}, etc.
webcert certificate resolver)traefik network: docker network create traefikxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience