Add client download link and build tarball during deployment

- Added /download/client endpoint to serve the CLI client tarball
- Added "Client" link to navigation in base template
- Created build-client.sh script to clone and package the client
- Updated Dockerfile to run build-client.sh during container build

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 19:08:55 +00:00
parent 0ddeb5ba94
commit ab2f65e14d
4 changed files with 59 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ COPY . .
# Clone effects repo # Clone effects repo
RUN git clone https://git.rose-ash.com/art-dag/effects.git /app/artdag-effects RUN git clone https://git.rose-ash.com/art-dag/effects.git /app/artdag-effects
# Build client tarball for download
RUN ./build-client.sh
# Create cache directory # Create cache directory
RUN mkdir -p /data/cache RUN mkdir -p /data/cache

View File

@@ -5,8 +5,8 @@ Home and root routes for L1 server.
from pathlib import Path from pathlib import Path
import markdown import markdown
from fastapi import APIRouter, Request, Depends from fastapi import APIRouter, Request, Depends, HTTPException
from fastapi.responses import HTMLResponse, RedirectResponse from fastapi.responses import HTMLResponse, RedirectResponse, FileResponse
from artdag_common import render from artdag_common import render
from artdag_common.middleware import wants_html from artdag_common.middleware import wants_html
@@ -77,3 +77,19 @@ async def login_redirect(request: Request):
"<p>No L2 server configured for authentication.</p></body></html>", "<p>No L2 server configured for authentication.</p></body></html>",
status_code=503 status_code=503
) )
# Client tarball path
CLIENT_TARBALL = Path(__file__).parent.parent.parent / "artdag-client.tar.gz"
@router.get("/download/client")
async def download_client():
"""Download the Art DAG CLI client."""
if not CLIENT_TARBALL.exists():
raise HTTPException(404, "Client package not found. Run build-client.sh to create it.")
return FileResponse(
CLIENT_TARBALL,
media_type="application/gzip",
filename="artdag-client.tar.gz"
)

View File

@@ -8,6 +8,7 @@
<a href="/recipes" class="text-gray-300 hover:text-white {% if active_tab == 'recipes' %}text-white font-medium{% endif %}">Recipes</a> <a href="/recipes" class="text-gray-300 hover:text-white {% if active_tab == 'recipes' %}text-white font-medium{% endif %}">Recipes</a>
<a href="/media" class="text-gray-300 hover:text-white {% if active_tab == 'media' %}text-white font-medium{% endif %}">Media</a> <a href="/media" class="text-gray-300 hover:text-white {% if active_tab == 'media' %}text-white font-medium{% endif %}">Media</a>
<a href="/storage" class="text-gray-300 hover:text-white {% if active_tab == 'storage' %}text-white font-medium{% endif %}">Storage</a> <a href="/storage" class="text-gray-300 hover:text-white {% if active_tab == 'storage' %}text-white font-medium{% endif %}">Storage</a>
<a href="/download/client" class="text-gray-300 hover:text-white" title="Download CLI client">Client</a>
</nav> </nav>
{% endblock %} {% endblock %}

37
build-client.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Build the artdag-client tarball
# This script is run during deployment to create the downloadable client package
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLIENT_REPO="https://git.rose-ash.com/art-dag/client.git"
TEMP_DIR=$(mktemp -d)
OUTPUT_FILE="$SCRIPT_DIR/artdag-client.tar.gz"
echo "Building artdag-client.tar.gz..."
# Clone the client repo
git clone --depth 1 "$CLIENT_REPO" "$TEMP_DIR/artdag-client" 2>/dev/null || {
echo "Failed to clone client repo, trying alternative..."
# Try GitHub if internal git fails
git clone --depth 1 "https://github.com/gilesbradshaw/art-client.git" "$TEMP_DIR/artdag-client" 2>/dev/null || {
echo "Error: Could not clone client repository"
rm -rf "$TEMP_DIR"
exit 1
}
}
# Remove .git directory
rm -rf "$TEMP_DIR/artdag-client/.git"
rm -rf "$TEMP_DIR/artdag-client/__pycache__"
# Create tarball
cd "$TEMP_DIR"
tar -czf "$OUTPUT_FILE" artdag-client
# Cleanup
rm -rf "$TEMP_DIR"
echo "Created: $OUTPUT_FILE"
ls -lh "$OUTPUT_FILE"