ultravibed

This commit is contained in:
2026-05-24 02:05:39 +03:00
parent 8fe04e77a2
commit f0a84eb491
4 changed files with 26 additions and 15 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
ARG PYTHON_IMAGE
ARG PYTHON_IMAGE=python:3.14-slim
FROM ${PYTHON_IMAGE}
RUN pip install --no-cache-dir docker
@@ -11,5 +11,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certifi
&& rm -rf /var/lib/apt/lists/*
COPY src/dnc /opt/dnc/lib/dnc
ENV PYTHONPATH=/opt/dnc/lib:$PYTHONPATH
ENV PYTHONPATH=/opt/dnc/lib
ENTRYPOINT ["python3", "-m", "dnc"]
+14 -13
View File
@@ -46,15 +46,15 @@ def _show_help():
print(f"""dnc — dockernecontainer v{__version__}
Usage:
dnc Enter container
dnc - <cmd> Run command in container
dnc setup [--image IMG] Create container for this project
dnc rm Remove container + .dnc
dnc list List all dnc containers
dnc info Show container details
dnc agent [--opencode] [--cursor] Create DNC.md + agent rules
dnc version Show version
dnc help Show this help""")
dnc Enter container
dnc -- <cmd> Run command in container
dnc setup [--image IMG] Create container for this project
dnc rm Remove container + .dnc
dnc list List all dnc containers
dnc info Show container details
dnc agent [--opencode] [--cursor] Create DNC.md + agent rules
dnc version Show version
dnc help Show this help""")
def main():
@@ -98,7 +98,7 @@ def main():
if cmd == "setup":
parser = argparse.ArgumentParser(prog="dnc setup")
parser.add_argument("--image", "-i", default=None)
parsed, _ = parser.parse_known_args(args[1:])
parsed = parser.parse_args(args[1:])
project_dir = os.getcwd()
dnc_path = os.path.join(project_dir, DNC_FILE)
@@ -149,7 +149,7 @@ def main():
parser = argparse.ArgumentParser(prog="dnc agent")
parser.add_argument("--opencode", action="store_true")
parser.add_argument("--cursor", action="store_true")
parsed, _ = parser.parse_known_args(args[1:])
parsed = parser.parse_args(args[1:])
agents_mod.create_dnc_md(os.getcwd())
if parsed.opencode:
agents_mod.create_opencode(os.getcwd())
@@ -167,7 +167,7 @@ def main():
print(f"Removed container '{name}' and {DNC_FILE}.")
return
if cmd == "-":
if cmd == "--":
dnc_dir, name = resolve_container_name()
if name is None:
print("No .dnc found. Run 'dnc setup' first.")
@@ -180,5 +180,6 @@ def main():
ctr.exec_passthrough(name, rest, interactive=interactive)
return
_show_help()
print(f"Unknown command: {cmd}", file=sys.stderr)
print(f"Run 'dnc help' for usage.", file=sys.stderr)
sys.exit(1)
+6
View File
@@ -198,6 +198,7 @@ def create(image: str, name: str, project_dir: str):
"dnc.gpu": gpu,
}
container = None
try:
container = client.containers.create(
image,
@@ -230,6 +231,11 @@ def create(image: str, name: str, project_dir: str):
)
container.start()
except docker.errors.APIError as e:
if container is not None:
try:
container.remove(force=True)
except Exception:
pass
print(f"Error: failed to create/start container '{name}'.", file=sys.stderr)
print(f" {e}", file=sys.stderr)
sys.exit(1)
+4
View File
@@ -39,6 +39,10 @@ if ! command -v sudo >/dev/null 2>&1; then
apk add sudo || true
elif command -v zypper >/dev/null 2>&1; then
zypper install -y sudo || true
elif command -v pacman >/dev/null 2>&1; then
pacman -Sy --noconfirm sudo || true
elif command -v xbps-install >/dev/null 2>&1; then
xbps-install -Sy sudo || true
fi
fi