Skip to content

Add Docker support for running onnx-modifier#146

Open
helloworld77 wants to merge 8 commits into
ZhangGe6:masterfrom
helloworld77:master
Open

Add Docker support for running onnx-modifier#146
helloworld77 wants to merge 8 commits into
ZhangGe6:masterfrom
helloworld77:master

Conversation

@helloworld77

@helloworld77 helloworld77 commented Feb 11, 2026

Copy link
Copy Markdown

Description

Summary

This PR adds the ability to run onnx-modifier in a Docker container, so users can start the service without installing Python or dependencies locally. The documentation in README is updated with a new section "launch from Docker container".

Motivation

  • Users in containerized or restricted environments can run onnx-modifier without a local Python setup.
  • Deployment and sharing become easier (e.g. on servers or CI).
  • Keeps the same workflow as other launch methods (clone → run → open in browser).

Changes

  1. Dockerfile (new)

    • Base image: Python 3.9 slim.
    • Install dependencies from requirements.txt.
    • Default command: python entry.py --host 0.0.0.0 --port 5000 so the app is reachable from outside the container.
  2. README.md

    • New section "launch from Docker container" with:
      • docker build and docker run commands.
      • Note that Flask will show http://0.0.0.0:5000/ and http://127.0.0.1:5000/; opening either in the browser launches onnx-modifier.
  3. onnx_modifier/flask_server.py

    • entry.py (or the script that starts the server) is assumed to support --host and --port so the server can bind to 0.0.0.0:5000 inside the container. Any small changes in this file are to support that and/or fix download behavior when running in Docker (e.g. using absolute path for send_file if needed). Models can now download directly through the browser as a standard file.

How to use (for reviewers/users)

git clone https://github.com/ZhangGe6/onnx-modifier.git
cd onnx-modifier
docker build -t onnxmodifier .
docker run -d --restart always --pids-limit -1 --security-opt seccomp=unconfined -p 5000:5000 --name onnxmodifier onnxmodifier

Then open http://127.0.0.1:5000/ (or http://0.0.0.0:5000/) in a browser.

Note for maintainers

  • If you prefer to use the official Docker Hub Python image in the upstream repo, the Dockerfile base image can be set to python:3.9-slim and pip install can be run without a custom index (e.g. remove -i https://pypi.tuna.tsinghua.edu.cn/simple for a generic Dockerfile).

修改说明

主要特征:支持通过 Docker 容器启动 onnx-modifier

简述

本 PR 增加通过 Docker 运行 onnx-modifier 的方式,并在 README 中新增「launch from Docker container」小节,包含构建与运行命令。使用方式与从源码启动一致:构建镜像 → 运行容器 → 在浏览器中打开输出的地址即可使用。

主要修改

  1. 新增 Dockerfile:基于 Python 3.9 slim,安装 requirements.txt,默认以 --host 0.0.0.0 --port 5000 启动,便于从宿主机访问。
  2. 更新 README.md:增加 Docker 构建与运行示例,并说明浏览器可访问 http://0.0.0.0:5000/http://127.0.0.1:5000/
  3. onnx_modifier/flask_server.py:确保支持 --host/--port 并在容器内正确绑定;如有需要,修正下载逻辑(如使用绝对路径)以在 Docker 环境下正常工作。修改static/index.js 和 flask_server.py,支持浏览器直接下载修改后的模型作为标准文件(同时保留原有的存储到指定目录)。

使用步骤

见上方英文版中的 docker builddocker run 命令,启动后在浏览器打开 http://127.0.0.1:5000/ 即可。

ZhangGe6 and others added 8 commits February 2, 2025 10:14
Major UI/UX improvements:
- Unified button styling across all components with consistent neutral colors
- Redesigned toolbar buttons: 1.83x larger (44x44px) with professional styling
- Horizontal toolbar layout with proper spacing and alignment
- Added theme toggle button to toolbar with sun/moon icons

Technical changes:
- Standardized fonts to system font stack across all components
- Fixed Node Properties alignment (removed extra left spacing)
- Added null checks for removed DOM elements (shapeInference, cleanUp, addNode)
- Enhanced dark theme support for all new components
- Improved button hover effects with smooth animations
- Added flex spacer to position Back/Name buttons at toolbar end
feat: Redesign UI with modern styling and improved UX
…ovement

Revert "feat: Redesign UI with modern styling and improved UX"
@ZhangGe6

Copy link
Copy Markdown
Owner

@helloworld77 Thanks for the contribution. What are the necessities of the modifications in static/index.js and flask_server.py?

@helloworld77

Copy link
Copy Markdown
Author

@helloworld77 Thanks for the contribution. What are the necessities of the modifications in static/index.js and flask_server.py?

"Sorry for the late reply. The modifications in static/index.js and flask_server.py enable a direct browser-side download feature.

Currently, the tool saves modified models into a predefined folder on the server. With these changes, users can now download the modified model directly through their browser as a standard file download, which is more flexible for remote deployments."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants