dockerize-project

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dockerize Current Project (Minimal)

将当前项目Docker化(轻量版)

Goal

目标

Analyze the current project’s files and generate a minimal, working Dockerfile and docker-compose.yml so the project can be started with
docker compose up --build
.
分析当前项目的文件,生成轻量、可用的Dockerfile和docker-compose.yml,使项目能够通过
docker compose up --build
启动。

Instructions

操作步骤

  1. Inspect the current project structure and identify the primary tech stack:
    • Python (pyproject.toml, uv.lock, requirements.txt, manage.py, app.py, main.py)
    • Node.js (package.json)
    • Other / generic
  2. Check whether Docker-related files already exist:
    • Dockerfile
    • docker-compose.yml / docker-compose.yaml
    • .dockerignore
    • If any exist, do NOT overwrite them. Ask the user whether to merge, regenerate with backups, or cancel.
  3. Infer a reasonable default entrypoint and port from the codebase.
    • If the entrypoint or port is unclear, ask up to three concise clarification questions.
  4. Generate the following files as complete code blocks:
    • Dockerfile (development-oriented, readable, non-root when reasonable)
    • docker-compose.yml (no
      version:
      field)
    • .dockerignore
  5. Prefer bind mounts for local development and explain how to change this if needed.
  1. 检查当前项目结构,识别主要技术栈:
    • Python(pyproject.toml、uv.lock、requirements.txt、manage.py、app.py、main.py)
    • Node.js(package.json)
    • 其他/通用类型
  2. 检查是否已存在Docker相关文件:
    • Dockerfile
    • docker-compose.yml / docker-compose.yaml
    • .dockerignore
    • 若存在任何上述文件,请勿覆盖。询问用户是选择合并、备份后重新生成还是取消操作。
  3. 从代码库中推断合理的默认入口点和端口。
    • 若入口点或端口不明确,最多提出3个简洁的澄清问题。
  4. 生成以下完整的代码块文件:
    • Dockerfile(面向开发、可读性强,合理情况下使用非root用户)
    • docker-compose.yml(不含
      version:
      字段)
    • .dockerignore
  5. 优先为本地开发使用绑定挂载,并说明如需修改该配置的方法。

Constraints

约束条件

  • Do not use
    sudo
    .
  • Do not hardcode secrets; use environment variables or an
    .env
    /
    .env.docker
    template if necessary.
  • Do not run Docker commands automatically.
  • Keep the setup minimal and easy to modify.
  • 不要使用
    sudo
    命令。
  • 不要硬编码密钥;必要时使用环境变量或
    .env
    /
    .env.docker
    模板。
  • 不要自动运行Docker命令。
  • 保持配置轻量且易于修改。

Output Format

输出格式

  1. Detection Summary
    • Detected stack
    • Assumed entrypoint
    • Assumed port
  2. Generated Files
    • Dockerfile
    • docker-compose.yml
    • .dockerignore
  3. How to Run
    • docker compose up --build
    • Common commands (
      logs
      ,
      exec
      )
  4. Notes
    • What to change if the entrypoint, port, or environment differs.
  1. 检测摘要
    • 检测到的技术栈
    • 假定的入口点
    • 假定的端口
  2. 生成的文件
    • Dockerfile
    • docker-compose.yml
    • .dockerignore
  3. 运行方式
    • docker compose up --build
    • 常用命令(
      logs
      exec
  4. 注意事项
    • 当入口点、端口或环境不同时需要修改的内容。

Example

示例

User: Dockerize this project for local development
Result:
  • Detect Python project
  • Generate Dockerfile + docker-compose.yml
  • Explain how to start and customize
用户: 将此项目Docker化用于本地开发
结果:
  • 检测到Python项目
  • 生成Dockerfile + docker-compose.yml
  • 说明启动和自定义的方法