Skip to content

ronald2wing/Dockerfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dockerfile Templates

Enterprise-Grade Dockerfile Templates for Modern Applications

Template Count License Website GitHub Stars GitHub Issues GitHub Forks

A curated collection of security-optimized, production-hardened Dockerfile templates adhering to industry security standards.

πŸš€ Quick Start

Build in Under 30 Seconds

# Download a template directly
curl -o Dockerfile https://raw.githubusercontent.com/ronald2wing/Dockerfile/master/frameworks/react.Dockerfile

# Or copy from this repository
cp frameworks/react.Dockerfile Dockerfile

# Build and run your application
docker build -t my-app .
docker run -p 3000:3000 my-app

Combine Templates for Custom Solutions

# Create a custom Dockerfile by combining templates
cat languages/nodejs.Dockerfile \
    patterns/multi-stage.Dockerfile \
    patterns/security-hardened.Dockerfile > Dockerfile

πŸ“Š Template Categories

Category Templates Description Ideal Use Case
πŸ—οΈ Framework Templates 13 templates Complete, production-hardened templates for specific frameworks Production deployments, rapid prototyping
πŸ’» Language Templates 8 templates Language-specific patterns designed for modular combination Custom applications, development environments
πŸ›‘οΈ Pattern Templates 6 templates Reusable patterns (security, multi-stage, optimization) Security hardening, performance optimization
πŸ”§ Tool Templates 8 templates Database, web server, and utility configurations Infrastructure deployment, tool containerization

🎯 Why Choose Dockerfile Templates?

Security First

  • Non-root execution by default in all framework templates
  • Specific version pinning (no latest tags)
  • Security-hardened configurations following OWASP guidelines
  • Regular security updates and vulnerability scanning

Production Ready

  • Multi-stage builds for optimized image sizes
  • Health checks for container orchestration
  • Resource limits and proper signal handling
  • Logging best practices implemented

Developer Experience

  • Clear documentation with practical examples
  • Modular design for easy customization
  • Consistent patterns across all templates
  • Quick start guides for rapid onboarding

πŸ› οΈ Template Examples

Framework Template (React)

# Use React template for production
cp frameworks/react.Dockerfile Dockerfile
docker build -t react-app .
docker run -p 3000:3000 react-app

Language + Pattern Combination

# Node.js with security hardening and multi-stage builds
cat languages/nodejs.Dockerfile \
    patterns/security-hardened.Dockerfile \
    patterns/multi-stage.Dockerfile > Dockerfile

Tool Deployment (PostgreSQL)

# Deploy PostgreSQL with production configuration
cp tools/postgresql.Dockerfile Dockerfile
docker build -t postgres-db .
docker run -p 5432:5432 postgres-db

πŸ“ Template Structure

Framework Templates (frameworks/)

Complete, self-contained templates for specific frameworks:

  • react.Dockerfile - React with production optimizations
  • vue.Dockerfile - Vue.js with build tooling
  • nextjs.Dockerfile - Next.js with SSR support
  • django.Dockerfile - Django with Gunicorn
  • flask.Dockerfile - Flask with production WSGI
  • spring-boot.Dockerfile - Spring Boot with JVM optimizations
  • laravel.Dockerfile - Laravel with PHP-FPM
  • angular.Dockerfile - Angular with build optimization
  • express.Dockerfile - Express.js with production settings
  • svelte.Dockerfile - Svelte with build pipeline
  • fastapi.Dockerfile - FastAPI with Uvicorn
  • ruby-on-rails.Dockerfile - Ruby on Rails with Puma
  • dotnet-core.Dockerfile - .NET Core with runtime optimization

Language Templates (languages/)

Language-specific patterns for combination:

  • nodejs.Dockerfile - Node.js runtime and tooling
  • python.Dockerfile - Python with package management
  • go.Dockerfile - Go compilation and runtime
  • java.Dockerfile - Java/JVM environment
  • ruby.Dockerfile - Ruby with gem management
  • php.Dockerfile - PHP with extensions
  • rust.Dockerfile - Rust compilation
  • typescript.Dockerfile - TypeScript compilation

Pattern Templates (patterns/)

Reusable cross-cutting concerns:

  • multi-stage.Dockerfile - Multi-stage build patterns
  • security-hardened.Dockerfile - Security hardening configurations
  • alpine.Dockerfile - Alpine Linux optimizations
  • docker-compose.Dockerfile - Docker Compose integration
  • development.Dockerfile - Development environment setup
  • hot-reload.Dockerfile - Hot reload for development

Tool Templates (tools/)

Database and infrastructure tools:

  • postgresql.Dockerfile - PostgreSQL database
  • nginx.Dockerfile - Nginx web server
  • mysql.Dockerfile - MySQL database
  • mongodb.Dockerfile - MongoDB database
  • redis.Dockerfile - Redis cache
  • traefik.Dockerfile - Traefik reverse proxy
  • certbot.Dockerfile - Certbot for SSL certificates
  • elasticsearch.Dockerfile - Elasticsearch search engine

πŸ”§ Best Practices

Security

  1. Always use specific versions - Never rely on latest tags
  2. Run as non-root user - All framework templates enforce this
  3. Regular vulnerability scanning - Use docker scan regularly
  4. Minimal base images - Start from minimal distributions like Alpine

Performance

  1. Multi-stage builds - Separate build and runtime stages
  2. Layer caching - Order instructions to maximize cache hits
  3. Image size optimization - Remove build dependencies in final stage
  4. Resource limits - Set memory and CPU constraints

Maintenance

  1. Regular updates - Update base images quarterly
  2. Version pinning - Pin all package versions
  3. Documentation - Keep usage examples current
  4. Testing - Test templates with each Docker version update

🀝 Contributing

We welcome contributions! Please see our CONTRIBUTING.md for:

  • Template creation guidelines
  • Contribution workflow
  • Code of conduct
  • Testing requirements

πŸ“š Documentation

🌐 Related Projects

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

❓ Getting Help


Thank you for using Dockerfile Templates! 🐳

Maintained by Dockerfile.io

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published