Skip to main content

docker support for nb-cli

Project description

nonebot

NB CLI Plugin Docker

✨ NoneBot2 命令行工具 Docker 插件 ✨

license pypi python pre-commit
QQ Chat Group QQ Channel Telegram Channel Discord Server

准备

在使用本插件前请确保 Docker CLI 以及 Docker Compose Plugin 已经安装,且可以从命令行直接使用。

详细安装方法请参考 Docker 文档

Docker 官方 Linux 快速安装一键脚本:

curl -fsSL https://get.docker.com | sudo sh

安装插件

uv tool / uvx(推荐)

首先需要安装 uv

直接使用:

uvx --from nb-cli --with nb-cli-plugin-docker nb docker
# 或
uv tool run --from nb-cli --with nb-cli-plugin-docker nb docker

安装:

uv tool install --with nb-cli-plugin-docker nb-cli

# 更新环境变量(如果需要)
uv tool update-shell

通用方式

nb self install nb-cli-plugin-docker

使用插件

nb docker
# 其他别名
# nb deploy
# nb compose

generate

生成 Dockerfiledocker-compose.yml

什么时候需要(重新)生成?

  • 在项目中首次使用本插件时;
  • 更换了机器人项目的管理器时。

传递项目依赖

对于使用了 uv, pdmpoetry 的机器人项目,本插件会自动检查相应的依赖固定信息(即 *.lock 文件)判断并调用相应工具自动向容器内传递依赖。

对于其他管理方式的机器人项目,则需要手动导出一份 requirements.txt 来传递项目依赖到容器内,例如:

source .venv/bin/activate
pip freeze > requirements.txt

build

构建机器人镜像。

up / down

部署/取消部署机器人实例。

logs

查看机器人日志。

ps

查看机器人运行状态。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nb_cli_plugin_docker-0.6.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nb_cli_plugin_docker-0.6.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file nb_cli_plugin_docker-0.6.1.tar.gz.

File metadata

  • Download URL: nb_cli_plugin_docker-0.6.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nb_cli_plugin_docker-0.6.1.tar.gz
Algorithm Hash digest
SHA256 122799062ad65c42dfc1a1745bedfc047f248f92aee3457070f43e45bcf13db9
MD5 be423bfaa6fcc7dc9d6a3a9d695094ef
BLAKE2b-256 cf8f6c836012a1d4fe85ceb16456ff6c0c1b8153f77566e79254e987ece68d90

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_cli_plugin_docker-0.6.1.tar.gz:

Publisher: release.yml on nonebot/cli-plugin-docker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nb_cli_plugin_docker-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nb_cli_plugin_docker-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e3899456eed1cdf91784e33db7924dbc03ab1447029f5d2a7a24f5dbe662612
MD5 15f53b802435a84e6b77413f5eb663d4
BLAKE2b-256 8073f68ea3430c27839d0a419fbcd6c7927e6d6172778fb30ddcac53329e5960

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_cli_plugin_docker-0.6.1-py3-none-any.whl:

Publisher: release.yml on nonebot/cli-plugin-docker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page