Saltar al contenido
Skillpedia
Deploy y nube (DevOps)40 mil · #7301

multi-stage-dockerfile

Qué hace

Este agente de IA ayuda a crear Dockerfiles eficientes para ejecutar programas en contenedores. Organiza el proceso en etapas para que el resultado final sea más pequeño, más seguro y más rápido.

Cuándo usarla

  • ✓Cuando quieres crear un 'paquete' para ejecutar tu programa en cualquier lugar.
  • ✓Para que el 'paquete' de tu programa sea lo más pequeño posible.
  • ✓Para que el 'paquete' de tu programa sea más seguro frente a ataques.

Link de la skill

https://github.com/github/awesome-copilot/blob/main/skills/multi-stage-dockerfile/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/multi-stage-dockerfile/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Crea un Dockerfile optimizado para una aplicación de Node.js con React.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

Usa una técnica llamada 'construcciones multietapa' (multi-stage builds), en la que una etapa compila el programa y otra etapa, más limpia, solo lo ejecuta. Así, en el resultado final solo entra lo esencial.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Your goal is to help me create efficient multi-stage Dockerfiles that follow best practices, resulting in smaller, more secure container images.

Multi-Stage Structure

  • Use a builder stage for compilation, dependency installation, and other build-time operations
  • Use a separate runtime stage that only includes what's needed to run the application
  • Copy only the necessary artifacts from the builder stage to the runtime stage
  • Use meaningful stage names with the AS keyword (e.g., FROM node:18 AS builder)
  • Place stages in logical order: dependencies → build → test → runtime

Base Images

  • Start with official, minimal base images when possible
  • Specify exact version tags to ensure reproducible builds (e.g., python:3.11-slim not just python)
  • Consider distroless images for runtime stages where appropriate
  • Use Alpine-based images for smaller footprints when compatible with your application
  • Ensure the runtime image has the minimal necessary dependencies

Layer Optimization

  • Organize commands to maximize layer caching
  • Place commands that change frequently (like code changes) after commands that change less frequently (like dependency installation)
  • Use .dockerignore to prevent unnecessary files from being included in the build context
  • Combine related RUN commands with && to reduce layer count
  • Consider using COPY --chown to set permissions in one step

Security Practices

  • Avoid running containers as root - use USER instruction to specify a non-root user
  • Remove build tools and unnecessary packages from the final image
  • Scan the final image for vulnerabilities
  • Set restrictive file permissions
  • Use multi-stage builds to avoid including build secrets in the final image

Performance Considerations

  • Use build arguments for configuration that might change between environments
  • Leverage build cache efficiently by ordering layers from least to most frequently changing
  • Consider parallelization in build steps when possible
  • Set appropriate environment variables like NODE_ENV=production to optimize runtime behavior
  • Use appropriate healthchecks for the application type with the HEALTHCHECK instruction
Preguntas frecuentes

¿Qué es un Dockerfile?

Es un archivo de texto con instrucciones para que Docker cree un entorno aislado (contenedor) donde pueda ejecutarse tu programa.

¿Por qué es mejor 'multietapa'?

Porque separa las herramientas de 'compilación' del entorno de 'ejecución', lo que da como resultado un contenedor final mucho más pequeño y seguro.

¿Qué son los 'contenedores'?

Son como cajas aisladas que contienen todo lo que un programa necesita para ejecutarse, lo que facilita que funcione en distintos ordenadores.

Detalles

Descripción original del autor

Create optimized multi-stage Dockerfiles for any language or framework

repo: github/awesome-copilot

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7301
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas