From 8367e2b7c850e0c00fc4c442a93c902157e33483 Mon Sep 17 00:00:00 2001 From: Torres Date: Tue, 10 Nov 2026 21:23:48 -0400 Subject: [PATCH] deploy/Dockerfile (python:3.13-slim app contract) + README run/develop section - Dockerfile: 3.13-slim, pip install requirements.txt, copy app/, EXPOSE 8000, serves /data/bike-tinder.sqlite3 + /data/img on 0.0.0.0:8000 (compose/systemd/tailscale stay with the parent) - README: status line now reflects Phase 2; added Run & develop (venv, importer, imgfetch incl. --limit, serve, selfcheck, deck CLI, route map) --- README.md | 35 ++++++++++++++++++++++++++++++++++- deploy/Dockerfile | 15 +++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 deploy/Dockerfile diff --git a/README.md b/README.md index 6e7521b..fcbc9f4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A private, Tinder-style web app for browsing the motorcycle market: swipe real listings (like / nope / maybe), see everything on one editable list, and let the deck learn your taste. Built for Glenn; runs on the Rotarran, published to the tailnet only. -**Status:** v0.1 — design phase. No code yet; this repo currently holds the design docs. Build begins once the docs are approved. +**Status:** Phase 2 (production build) — FastAPI backend + no-build PWA shipped on `dev` (2026-11-10): migrations, API with cursor-paginated deck, swipe persistence, real list/matches screens, image mirror, PWA shell. Deployment (podman stack) is Phase 4 — not started. ## How it works @@ -33,6 +33,39 @@ A private, Tinder-style web app for browsing the motorcycle market: swipe real l - `dev` — active development; build work lands here first. - `release` — deployable cuts; the Rotarran stack tracks this branch. +## Run & develop + +Everything runs from the repo root (Python 3.13+, stdlib where possible). + +```sh +# one-time setup +python3 -m venv .venv +.venv/bin/pip install -r requirements.txt # fastapi + uvicorn (+ httpx for tests) + +# import the hunt state into the DB (idempotent; safe to re-run any time) +python3 -m app.importer --state-dir ~/.hermes/scripts/motorcycle-hunt.d --db data/bike-tinder.sqlite3 + +# mirror card images into data/img/ (polite: ~1 req/s, skip-existing, resumable) +.venv/bin/python -m app.imgfetch --db data/bike-tinder.sqlite3 +.venv/bin/python -m app.imgfetch --limit 15 # small test runs + +# serve the app (127.0.0.1:9453 by default) +.venv/bin/python -m app.serve --db data/bike-tinder.sqlite3 --port 9453 + +# self-check: 8 P1 spine checks + 6 P2 API checks (on a temp DB copy) +.venv/bin/python -m app.selfcheck + +# proof CLI: ranked deck + counts (read-only) +python3 -m app.deck --db data/bike-tinder.sqlite3 --top 15 +``` + +Key routes: `/` (PWA), `/api/health`, `/api/stats`, `/api/deck?limit=&cursor=`, +`POST /api/swipe` / `DELETE /api/swipe/{id}`, `/api/list?decision=&sort=&q=&limit=&offset=`, +`/api/listing/{id}`, `POST /api/import`, `POST /api/badge/seen`, `/img/{id}` +(cached file → 302 source CDN → 404 placeholder). Full contract: `docs/UI-SPEC.md` + the task brief. + +`data/` and `.venv/` are gitignored — the DB, image mirror and venv are local state. + ## Deployment (planned) A small podman compose stack on the Rotarran under `/var/mnt/DATA/podman-stacks/bike-tinder/`, its own systemd user unit (`Delegate=yes`), SQLite database. The stack ships its own Tailscale node (sidecar container — no host-tailnet coupling) and serves the app privately at `https://biketinder.tailf35a34.ts.net`. Single user; reachable only from Glenn's own devices. diff --git a/deploy/Dockerfile b/deploy/Dockerfile new file mode 100644 index 0000000..2e3daec --- /dev/null +++ b/deploy/Dockerfile @@ -0,0 +1,15 @@ +# Bike-Tinder app container (Phase 2 build). +# The compose stack, systemd unit and Tailscale sidecar belong to the parent — +# this file is only the app image contract. +FROM python:3.13-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app/ ./app/ + +# Data lands on the stack volume: /data/bike-tinder.sqlite3 and /data/img/ +EXPOSE 8000 +CMD ["python", "-m", "app.serve", "--host", "0.0.0.0", "--port", "8000", "--db", "/data/bike-tinder.sqlite3", "--img-dir", "/data/img"]