Skip to content

tose generate ​

Generate a Dockerfile for your project using AI.

Synopsis ​

bash
tose generate [-o <path>] [--overwrite] [--skip-commit] [--auto-commit] [--auto-push]

Description ​

Scans your project source code, detects the language, framework, and package manager, then uses AI to generate an optimized Dockerfile. The generated Dockerfile is tailored to your project's stack and follows best practices for production deployments.

Options ​

OptionDescription
-o, --output <path>Output file path (default: Dockerfile)
--overwriteOverwrite existing Dockerfile
--skip-commitSkip the git commit prompt
--auto-commitAutomatically commit without prompting
--auto-pushAutomatically push after commit

Usage ​

Generate Dockerfile ​

bash
$ tose generate

Scanning source code...
✓ Source code scanned
  Language: Node.js
  Framework: Next.js
  Package Manager: npm

Generating Dockerfile with AI...
✓ Dockerfile generated

Dockerfile saved to Dockerfile

Commit Dockerfile to git? Yes
✓ Adding to git...
  Committed to git

Review and customize the Dockerfile as needed.

Overwrite Existing Dockerfile ​

bash
$ tose generate --overwrite

Scanning source code...
✓ Source code scanned
  Language: Python
  Framework: FastAPI
  Package Manager: pip

Generating Dockerfile with AI...
✓ Dockerfile generated

Dockerfile saved to Dockerfile

Custom Output Path ​

bash
$ tose generate -o docker/Dockerfile.prod

Skip Git Commit ​

bash
$ tose generate --skip-commit

Auto Commit and Push ​

bash
$ tose generate --auto-commit --auto-push

Detected Languages ​

LanguageDetection File
Node.jspackage.json
Pythonrequirements.txt, setup.py, Pipfile
RustCargo.toml
Gogo.mod
Javapom.xml, build.gradle
PHPcomposer.json
RubyGemfile

Detected Frameworks ​

Node.js ​

  • Next.js
  • React
  • Express
  • NestJS
  • Fastify
  • Koa

Python ​

  • Django
  • Flask
  • FastAPI

Detected Package Managers ​

ManagerDetection File
npmpackage-lock.json
yarnyarn.lock
pnpmpnpm-lock.yaml
bunbun.lock

JSON Output ​

bash
$ tose generate --json --skip-commit
json
{
  "success": true,
  "data": {
    "path": "Dockerfile",
    "language": "Node.js",
    "framework": "Next.js"
  }
}

How It Works ​

  1. Scan - Reads key project files (package.json, config files, directory structure)
  2. Detect - Identifies language, framework, and package manager
  3. Generate - Sends project context to the TOSE AI API
  4. Save - Writes the generated Dockerfile to disk
  5. Commit (optional) - Commits the Dockerfile with message Add Dockerfile (generated by tose)

TIP

The generated Dockerfile is a starting point. Review it and customize for your specific needs, especially for production deployments.

Released under the ISC License.