A command-line tool for generating Dockerfiles for various project types with VS Code integration.
- Auto-detection: Automatically detects project type based on project files
- Multiple language support: Node.js, Python, Go, Java, Ruby, PHP, Rust and more
- Framework awareness: Detects frameworks like React, Express, NextJS
- VS Code extension: Seamless integration with Visual Studio Code
- Interactive mode: Guided setup for your Dockerfile
- Customization: Configure exposed ports, entry points, and more
# Install globally
npm install -g dockerfile-gen
# Or install locally
npm install --save-dev dockerfile-gen
Type | Detected By | Dockerfile Type |
---|---|---|
node | package.json | Node.js base |
express | express in dependencies | Node.js with server.js |
nestjs | @nestjs/core in dependencies | Node.js with NestJS build |
react | react in dependencies | Multi-stage, Nginx |
nextjs | next in dependencies | Multi-stage, Nginx |
vue | vue in dependencies | Multi-stage, Nginx |
svelte | svelte in dependencies | Multi-stage, Nginx |
angular | angular in dependencies | Multi-stage, Nginx |
python | main.py or Python files | Python with main.py |
python-pip | requirements.txt | Python + pip install |
python-poetry | pyproject.toml | Python + Poetry (incomplete) |
golang | main.go | Multi-stage Golang |
rust | main.rs | ❌ Not fully implemented |
java | Main.java | ❌ Not implemented yet |
spring-boot | pom.xml or Spring files | ❌ Not implemented yet |
dotnet | .csproj or Program.cs | ❌ Not implemented yet |
laravel | artisan file | ❌ Not implemented yet |
rails | Gemfile | ❌ Not implemented yet |
static-site | index.html only | Static HTML site via Nginx |
- Install from VS Code Marketplace: search for "Dockerfile Generator"
- Or manually:
cd vscode-extension npm install npm run package code --install-extension dockerfile-generator-0.1.0.vsix
# Basic usage (auto-detects project type)
dockerfile-gen
# Interactive mode
dockerfile-gen -i
# Specify project type
dockerfile-gen -t node
# Specify directory and output file
dockerfile-gen -d /path/to/project -o /path/to/Dockerfile
# Specify port to expose
dockerfile-gen -p 8080
# Verbose output (shows details and preview)
dockerfile-gen -v
- Right-click on a folder in Explorer
- Select "Generate Dockerfile"
- Follow the prompts
- Edit the generated Dockerfile if needed
- Node.js: Standard Node.js, Express, React, NextJS
- Python: Standard Python, pip, pipenv, poetry
- Go: Standard Go projects
- Java: Standard Java, Maven, Gradle
- Ruby: Ruby/Rails projects
- PHP: Standard PHP, Composer-based projects
- Rust: Cargo-based projects
Option | Description |
---|---|
-i, --interactive |
Run in interactive mode |
-t, --type <type> |
Specify project type |
-d, --dir <directory> |
Specify project directory (default: current directory) |
-o, --output <file> |
Specify output Dockerfile path (default: ./Dockerfile) |
-p, --port <port> |
Specify port to expose (default: 3000) |
-v, --verbose |
Verbose output with details and preview |
-h, --help |
Display help information |
-V, --version |
Display version information |
The generator creates optimized Dockerfiles for each project type:
- Node.js: Multi-stage builds for React, production-ready NextJS configurations
- Python: Proper dependency management for pip, pipenv, and poetry
- Go: Optimized multi-stage builds with proper Go module handling
- Java: Maven and Gradle builds with JRE-only runtime images
- Ruby: Proper Gemfile handling
- PHP: Apache integration with Composer support
- Rust: Cargo-based builds with dependency caching
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
PS I VIBE CODED THE WHOLE THING SO HAVE NOT CHECKED THIS FULLY