automated update: 2026-06-10 20:13:26
This commit is contained in:
+4
-50
@@ -13,67 +13,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
|
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
|
||||||
&& ln -sf /usr/bin/python3.12 /usr/bin/python3
|
&& ln -sf /usr/bin/python3.12 /usr/bin/python3
|
||||||
|
|
||||||
# Install uv to system path
|
# Install uv
|
||||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
||||||
&& cp /root/.local/bin/uv /usr/local/bin/uv \
|
&& cp /root/.local/bin/uv /usr/local/bin/uv \
|
||||||
&& chmod 755 /usr/local/bin/uv
|
&& chmod 755 /usr/local/bin/uv
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Clone repo and install dependencies
|
# Clone your specific repo
|
||||||
RUN git clone --depth 1 https://github.com/sudolulo/if_curator_headless.git . \
|
RUN git clone --depth 1 https://github.com/sudolulo/if_curator_headless.git . \
|
||||||
&& uv sync --extra gpu \
|
&& uv sync --extra gpu \
|
||||||
&& uv add croniter \
|
&& uv add croniter \
|
||||||
&& uv cache clean
|
&& uv cache clean
|
||||||
|
|
||||||
# Apply enhanced upload_to_frigate function in-place
|
# Permissions for entrypoint
|
||||||
RUN sed -i '/def upload_to_frigate/,/if failed == total_files/c\
|
RUN chmod +x entrypoint.sh
|
||||||
def upload_to_frigate(jobs: list[dict]) -> None:\
|
|
||||||
"""Upload processed face crops to Frigate via API with detailed logging."""\
|
|
||||||
frigate_url = os.environ.get("FRIGATE_URL", "")\
|
|
||||||
if not frigate_url:\
|
|
||||||
rprint("[yellow]⚠️ FRIGATE_URL not set, skipping upload.[/yellow]")\
|
|
||||||
return\
|
|
||||||
\
|
|
||||||
rprint("\\n[bold cyan]📤 Uploading to Frigate[/bold cyan]")\
|
|
||||||
rprint(f" Target: [dim]{frigate_url}[/dim]")\
|
|
||||||
\
|
|
||||||
total_files = 0\
|
|
||||||
for job in jobs:\
|
|
||||||
name = job["person"]["name"]\
|
|
||||||
person_dir = os.path.join(Config.OUTPUT_DIR, name)\
|
|
||||||
if not os.path.isdir(person_dir): continue\
|
|
||||||
total_files += sum(1 for f in os.listdir(person_dir) if f.lower().endswith((".jpg", ".jpeg", ".png", ".webp")))\
|
|
||||||
\
|
|
||||||
if total_files == 0:\
|
|
||||||
rprint(" [yellow]No images found to upload.[/yellow]")\
|
|
||||||
return\
|
|
||||||
\
|
|
||||||
rprint(f" People: [bold]{len(jobs)}[/bold], Total images: [bold]{total_files}[/bold]")\
|
|
||||||
uploaded, failed = 0, 0\
|
|
||||||
\
|
|
||||||
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), BarColumn(), TaskProgressColumn(), console=console) as progress:\
|
|
||||||
upload_task = progress.add_task("[green]Uploading to Frigate", total=total_files)\
|
|
||||||
for job in jobs:\
|
|
||||||
name = job["person"]["name"]\
|
|
||||||
encoded_name = quote(name, safe="")\
|
|
||||||
person_dir = os.path.join(Config.OUTPUT_DIR, name)\
|
|
||||||
person_files = sorted(f for f in os.listdir(person_dir) if f.lower().endswith((".jpg", ".jpeg", ".png", ".webp"))) if os.path.isdir(person_dir) else []\
|
|
||||||
for fname in person_files:\
|
|
||||||
fpath = os.path.join(person_dir, fname)\
|
|
||||||
try:\
|
|
||||||
with open(fpath, "rb") as f:\
|
|
||||||
resp = requests.post(f"{frigate_url}/api/faces/train/{encoded_name}/classify", files={"file": (fname, f, "image/jpeg")}, timeout=30)\
|
|
||||||
if resp.status_code == 200: uploaded += 1\
|
|
||||||
else: failed += 1\
|
|
||||||
except Exception: failed += 1\
|
|
||||||
progress.advance(upload_task)\
|
|
||||||
\
|
|
||||||
rprint("\\n [bold]Frigate Upload Summary:[/bold]\\n ✅ Succeeded: [green]{uploaded}[/green]\\n ❌ Failed: [red]{failed}[/red]")' /app/if_curator/cli.py
|
|
||||||
|
|
||||||
# Copy scripts
|
|
||||||
COPY entrypoint.sh scheduler.py /app/
|
|
||||||
RUN chmod +x /app/entrypoint.sh
|
|
||||||
|
|
||||||
# Setup non-root user and persistent model paths
|
# Setup non-root user and persistent model paths
|
||||||
RUN groupadd -g 568 apps \
|
RUN groupadd -g 568 apps \
|
||||||
|
|||||||
Reference in New Issue
Block a user