Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 15
feat: Add Docker support for patch-backporting#16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Git | ||
| .git | ||
| .gitignore | ||
| # Python | ||
| __pycache__ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
| .Python | ||
| env/ | ||
| venv/ | ||
| .venv/ | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
| # PDM | ||
| pdm.lock | ||
| .pdm-python | ||
| # IDEs | ||
| .idea/ | ||
| .vscode/ | ||
| # Project specific | ||
| logs/ | ||
| .claude/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Use an official Python runtime as a parent image | ||
| FROM python:3.10-slim | ||
| # Set environment variables | ||
| ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
| PYTHONUNBUFFERED=1 | ||
| # Install system dependencies | ||
| # git: for GitPython | ||
| # curl: for downloading files | ||
| # universal-ctags: for code indexing | ||
| # build-essential, cmake, autoconf, automake, libtool, pkg-config: for compiling target projects (like libtiff) | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| git \ | ||
| curl \ | ||
| universal-ctags \ | ||
| build-essential \ | ||
| cmake \ | ||
| autoconf \ | ||
| automake \ | ||
| libtool \ | ||
| pkg-config \ | ||
| zlib1g-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| # Install Docker CLI manually | ||
| RUN curl -fsSL https://download.docker.com/linux/static/stable/$(uname -m)/docker-24.0.5.tgz -o docker.tgz \ | ||
| && tar xzvf docker.tgz \ | ||
| && mv docker/docker /usr/local/bin/ \ | ||
| && rm -rf docker docker.tgz | ||
| # Set the working directory in the container | ||
| WORKDIR /app | ||
| # Copy the requirements file into the container | ||
| COPY requirements.txt . | ||
| # Install Python dependencies | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
| # Copy the rest of the application code | ||
| COPY . . | ||
| # Change working directory to src as per usage instructions | ||
| WORKDIR /app/src | ||
| # Default command to run the application (prints help) | ||
| CMD ["python", "backporting.py", "--help"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,6 +26,30 @@ cd src | ||
| python backporting.py --config example.yml --debug # 记得填写配置文件 | ||
| ``` | ||
| ## Docker 使用方法 | ||
| 构建 Docker 镜像: | ||
| ```shell | ||
| docker build -t patch-backporting . | ||
| ``` | ||
| 运行容器: | ||
| ```shell | ||
| # 请确保挂载了必要的目录(项目代码、配置文件、数据集) | ||
| # 示例:假设当前目录下有 config.yml,数据集位于 /path/to/dataset | ||
| docker run --rm -v $(pwd):/app/src -v /path/to/dataset:/path/to/dataset patch-backporting python backporting.py --config config.yml | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same to README.en ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. README has been updated with the interactive mode instructions. Thanks! | ||
| ``` | ||
| 或者,您可以使用交互模式在容器内执行脚本: | ||
| ```shell | ||
| docker run --rm -it -v $(pwd):/app/src -v /path/to/dataset:/path/to/dataset patch-backporting /bin/bash | ||
| # 在容器内部执行 | ||
| python backporting.py --config config.yml | ||
| ``` | ||
| ## 配置结构 | ||
| ```yml | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also use
docker run -it patch-backporting /bin/bashand execute scripts in docker.Please add it to README.