Compare commits

..

1 Commits

Author SHA1 Message Date
9d2404d8f6 feat: add 7zz for CHM documentation extraction
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
2026-05-20 14:26:06 -04:00
3 changed files with 33 additions and 39 deletions

View File

@@ -1,23 +0,0 @@
FROM debian:13.4
# Install uv (Python package manager), curl, poppler-utils, and imagemagick
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
poppler-utils \
imagemagick && \
rm -rf /var/lib/apt/lists/*
# Install uv if not already present (debian:13.4 doesn't ship it)
COPY --from=ghcr.io/astral-sh/uv:latest /usr/local/bin/uv /usr/local/bin/uv
RUN uv --version
# Verify all expected tools are available
RUN curl --version && \
pdftotext -v 2>&1 | head -1 && \
pdfinfo -v 2>&1 | head -1 && \
pdftoppm -v 2>&1 | head -1 && \
convert --version | head -1 && \
identify --version | head -1
CMD ["/bin/bash"]

View File

@@ -129,22 +129,6 @@ services:
- "303"
- "26"
paperclip-db:
image: postgres:17
container_name: paperclip-db
restart: always
environment:
- POSTGRES_PASSWORD=${PAPERCLIP_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
volumes:
- /mnt/HoardingCow_docker_data/Paperclip/db:/var/lib/postgresql/data
networks:
- ai_backend
networks:
ai_net:
external: true

View File

@@ -79,6 +79,39 @@ PYEOF
COPY --chmod=0755 himalaya-ro.sh /usr/local/bin/himalaya-ro
# ---------- Install 7-Zip (7zz) for CHM extraction ----------
RUN /opt/hermes/.venv/bin/python3 /dev/stdin << 'PYEOF'
import urllib.request, tarfile, os, shutil, re, subprocess
# Scrape 7-zip.org for latest Linux x64 binary link
url = 'https://7-zip.org/download.html'
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
r = urllib.request.urlopen(req, timeout=15)
html = r.read().decode()
match = re.search(r'href="(a/7z[\d]+-linux-x64\.tar\.xz)"', html)
if not match:
raise RuntimeError('Could not find 7z Linux x64 download link on 7-zip.org')
dl_url = f'https://7-zip.org/{match.group(1)}'
# Follow Himalaya pattern: download, extract, install, verify
xz = '/tmp/7z.tar.xz'
urllib.request.urlretrieve(dl_url, xz)
os.makedirs('/tmp/7z', exist_ok=True)
with tarfile.open(xz, 'r:xz') as t:
t.extractall('/tmp/7z')
shutil.move('/tmp/7z/7zz', '/usr/local/bin/7zz')
os.chmod('/usr/local/bin/7zz', 0o755)
shutil.rmtree('/tmp/7z', ignore_errors=True)
os.remove(xz)
# Verify
result = subprocess.run(['/usr/local/bin/7zz'], capture_output=True, text=True)
assert result.returncode == 0, f'7zz verify failed: {result.stderr}'
version = result.stdout.split()[2] if result.stdout else 'unknown'
print(f'7-Zip {version} installed successfully')
PYEOF
# ---------- Runtime ----------
USER hermes
ENV HERMES_HOME=/opt/data