devarshia5 commited on
Commit
fd7a7ab
·
verified ·
1 Parent(s): 0ef6f6b

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -1
  2. start.sh +24 -7
Dockerfile CHANGED
@@ -2,7 +2,9 @@
2
  FROM python:3.12-slim
3
 
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
- curl ca-certificates && rm -rf /var/lib/apt/lists/*
 
 
6
 
7
  # HF Spaces run as uid 1000.
8
  RUN useradd -m -u 1000 user
 
2
  FROM python:3.12-slim
3
 
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ curl ca-certificates \
6
+ gnome-keyring libsecret-tools dbus dbus-x11 \
7
+ && rm -rf /var/lib/apt/lists/*
8
 
9
  # HF Spaces run as uid 1000.
10
  RUN useradd -m -u 1000 user
start.sh CHANGED
@@ -1,14 +1,31 @@
1
  #!/usr/bin/env bash
 
 
2
  set -e
3
 
4
- # 1) Materialize agy credentials from the AGY_CREDS_JSON secret to AGY_CREDS_PATH
5
- # (so the headless Linux agy can authenticate without a browser/keyring).
6
- python -c "from app.bootstrap import ensure_credentials; print('agy creds ->', ensure_credentials())" || true
 
 
7
 
8
- # 2) Quick agy auth self-check (logs whether the CLI can reach the model headless).
9
- if [ -x "${AGY_BIN:-agy}" ]; then
10
- echo "[start] agy version: $(${AGY_BIN:-agy} --version 2>/dev/null || echo '??')"
 
 
 
 
 
 
 
 
11
  fi
12
 
13
- # 3) Serve (HF routes traffic to $PORT, default 7860).
 
 
 
 
 
14
  exec uvicorn app.agy_server:app --host 0.0.0.0 --port "${PORT:-7860}"
 
1
  #!/usr/bin/env bash
2
+ # Antaram startup on HF (Linux). agy authenticates via the OS keyring (Secret
3
+ # Service), so we run a headless gnome-keyring and seed the token into it.
4
  set -e
5
 
6
+ # 1) D-Bus session + unlocked gnome-keyring secrets service.
7
+ export $(dbus-launch)
8
+ eval "$(printf '\n' | gnome-keyring-daemon --unlock --components=secrets 2>/dev/null)" || true
9
+ printf '\n' | gnome-keyring-daemon --start --components=secrets 2>/dev/null || true
10
+ sleep 2
11
 
12
+ # 2) Seed the agy OAuth credential into the keyring.
13
+ # Windows target was "gemini:antigravity" => Secret Service service/username.
14
+ KR_SERVICE="${AGY_KEYRING_SERVICE:-gemini}"
15
+ KR_USER="${AGY_KEYRING_USER:-antigravity}"
16
+ if [ -n "$AGY_CREDS_JSON" ]; then
17
+ if printf '%s' "$AGY_CREDS_JSON" | secret-tool store --label="${KR_SERVICE}:${KR_USER}" \
18
+ service "$KR_SERVICE" username "$KR_USER" 2>/dev/null; then
19
+ echo "[start] seeded keyring credential (${KR_SERVICE}:${KR_USER})"
20
+ else
21
+ echo "[start] WARN: secret-tool store failed (keyring may be unavailable)"
22
+ fi
23
  fi
24
 
25
+ # 3) Also drop the credential as a file (per-key homes do their own copy too).
26
+ python -c "from app.bootstrap import ensure_credentials; print('[start] creds file ->', ensure_credentials())" || true
27
+
28
+ echo "[start] agy version: $(${AGY_BIN:-agy} --version 2>/dev/null || echo '??')"
29
+
30
+ # 4) Serve (HF routes to $PORT, default 7860).
31
  exec uvicorn app.agy_server:app --host 0.0.0.0 --port "${PORT:-7860}"