initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Docker image commands."""
|
||||
|
||||
import os
|
||||
|
||||
import typer
|
||||
|
||||
from cli_tools.helpers import run
|
||||
|
||||
app = typer.Typer(help="Build and manage Docker images.", no_args_is_help=True)
|
||||
|
||||
DOCKER_IMAGE = "python-dev"
|
||||
DOCKER_DIR = "docker/python-dev"
|
||||
|
||||
|
||||
@app.command()
|
||||
def build(
|
||||
tag: str = typer.Option("latest", help="Image tag."),
|
||||
no_cache: bool = typer.Option(False, "--no-cache", help="Build without cache."),
|
||||
):
|
||||
"""Build the python-dev Docker image locally."""
|
||||
uid = os.getuid()
|
||||
gid = os.getgid()
|
||||
full_tag = f"{DOCKER_IMAGE}:{tag}"
|
||||
run(f"cp ai-tools/claude/CLAUDE.md {DOCKER_DIR}/CLAUDE.md")
|
||||
run(f"cp scripts/aliases.sh {DOCKER_DIR}/aliases.sh")
|
||||
run(f"cp scripts/bash_helpers.sh {DOCKER_DIR}/bash_helpers.sh")
|
||||
run(
|
||||
f"docker build -t {full_tag} "
|
||||
f"--build-arg UID={uid} --build-arg GID={gid} "
|
||||
f"{'--no-cache ' if no_cache else ''}"
|
||||
f"--network=host {DOCKER_DIR}",
|
||||
)
|
||||
Reference in New Issue
Block a user