Eren-Sama commited on
Commit ·
2a2bf3f
1
Parent(s): aaa2d62
Add HuggingFace Docker Space deployment — Dockerfile + README metadata
Browse files- Dockerfile +57 -0
- README.md +25 -99
Dockerfile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ──────────────────────────────────────────────
|
| 2 |
+
# Shortlist Backend — HuggingFace Spaces Dockerfile
|
| 3 |
+
# Deploys FastAPI backend as a Docker Space
|
| 4 |
+
# ──────────────────────────────────────────────
|
| 5 |
+
|
| 6 |
+
# Stage 1: Install dependencies
|
| 7 |
+
FROM python:3.12-slim AS builder
|
| 8 |
+
|
| 9 |
+
WORKDIR /build
|
| 10 |
+
|
| 11 |
+
RUN apt-get update && \
|
| 12 |
+
apt-get install -y --no-install-recommends gcc && \
|
| 13 |
+
rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
COPY backend/requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Stage 2: Production image
|
| 19 |
+
FROM python:3.12-slim
|
| 20 |
+
|
| 21 |
+
# HuggingFace Spaces requires UID 1000
|
| 22 |
+
RUN useradd -m -u 1000 user
|
| 23 |
+
|
| 24 |
+
WORKDIR /app
|
| 25 |
+
|
| 26 |
+
# Copy installed packages from builder
|
| 27 |
+
COPY --from=builder /install /usr/local
|
| 28 |
+
|
| 29 |
+
# Install git (needed for repo analyzer feature)
|
| 30 |
+
RUN apt-get update && \
|
| 31 |
+
apt-get install -y --no-install-recommends git && \
|
| 32 |
+
rm -rf /var/lib/apt/lists/*
|
| 33 |
+
|
| 34 |
+
# Copy backend application code
|
| 35 |
+
COPY --chown=user backend/app/ ./app/
|
| 36 |
+
COPY --chown=user backend/migrations/ ./migrations/
|
| 37 |
+
COPY --chown=user backend/apply_migration.py ./apply_migration.py
|
| 38 |
+
|
| 39 |
+
# Create temp directory for repo cloning
|
| 40 |
+
RUN mkdir -p /tmp/shortlist_repos && \
|
| 41 |
+
chown user:user /tmp/shortlist_repos && \
|
| 42 |
+
chmod 700 /tmp/shortlist_repos
|
| 43 |
+
|
| 44 |
+
# Switch to non-root user
|
| 45 |
+
USER user
|
| 46 |
+
|
| 47 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 48 |
+
|
| 49 |
+
# HuggingFace Spaces MUST listen on port 7860
|
| 50 |
+
EXPOSE 7860
|
| 51 |
+
|
| 52 |
+
# Run with uvicorn — single worker for HF free tier
|
| 53 |
+
CMD ["uvicorn", "app.main:app", \
|
| 54 |
+
"--host", "0.0.0.0", \
|
| 55 |
+
"--port", "7860", \
|
| 56 |
+
"--workers", "2", \
|
| 57 |
+
"--timeout-keep-alive", "120"]
|
README.md
CHANGED
|
@@ -1,107 +1,33 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
Paste a job description and Shortlist runs it through a pipeline of specialized AI agents:
|
| 10 |
-
|
| 11 |
-
1. **JD Analysis** — Extracts skills, role level, domain context, and what the company actually cares about
|
| 12 |
-
2. **Company Logic** — Applies behavioral modifiers based on company type (startup hustle vs. FAANG system design vs. consultancy breadth)
|
| 13 |
-
3. **Capstone Generator** — Proposes 3 project ideas engineered to hit the skills the JD demands, each with resume bullets and a recruiter-match score
|
| 14 |
-
4. **Repo Analyzer** — Scores any GitHub repo on structure, documentation, code quality, and how it reads to a non-technical recruiter
|
| 15 |
-
5. **Scaffold Generator** — Outputs a production-ready repo skeleton (directory tree, configs, starter code) for any selected project
|
| 16 |
-
6. **Portfolio Optimizer** — Generates README copy, resume bullets, a 60-second demo script, and a LinkedIn post for each project
|
| 17 |
-
7. **Resume Fitness Scorer** — Compares your existing resume against the JD analysis and scores the match with specific improvement suggestions
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
┌──────────────────┐
|
| 23 |
-
│ Nginx / Caddy │
|
| 24 |
-
│ (TLS + Proxy) │
|
| 25 |
-
└────┬────────┬────┘
|
| 26 |
-
│ │
|
| 27 |
-
┌──────────▼──┐ ┌──▼──────────┐
|
| 28 |
-
│ Backend │ │ Frontend │
|
| 29 |
-
│ (Gunicorn │ │ (Next.js │
|
| 30 |
-
│ +Uvicorn) │ │ Standalone)│
|
| 31 |
-
│ Port 8000 │ │ Port 3000 │
|
| 32 |
-
└──────┬──────┘ └──────────────┘
|
| 33 |
-
│
|
| 34 |
-
┌──────────┼──────────┐
|
| 35 |
-
│ │ │
|
| 36 |
-
┌─────▼─────┐ ┌──▼───┐ ┌───▼────┐
|
| 37 |
-
│ Supabase │ │ Groq │ │ GitHub │
|
| 38 |
-
│ (DB+Auth) │ │ (LLM)│ │ API │
|
| 39 |
-
└───────────┘ └──────┘ └────────┘
|
| 40 |
-
```
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Tech Stack
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
| Backend | FastAPI, Pydantic v2, Python 3.12 |
|
| 50 |
-
| AI Orchestration | LangGraph, langchain-groq |
|
| 51 |
-
| LLM | Groq (Llama 3.3 70B) |
|
| 52 |
-
| Database + Auth | Supabase (PostgreSQL + Row Level Security + Auth) |
|
| 53 |
-
| Deployment | Docker (multi-stage), Gunicorn + Uvicorn, GitHub Actions CI/CD |
|
| 54 |
-
|
| 55 |
-
## Project Structure
|
| 56 |
-
|
| 57 |
-
```
|
| 58 |
-
Shortlist/
|
| 59 |
-
├── backend/
|
| 60 |
-
│ ├── app/
|
| 61 |
-
│ │ ├── agents/
|
| 62 |
-
│ │ │ ├── nodes/ # 7 LangGraph nodes (jd, company, capstone,
|
| 63 |
-
│ │ │ │ # repo, scaffold, portfolio, fitness)
|
| 64 |
-
│ │ │ ├── orchestrator.py # Graph builder + pipeline routing
|
| 65 |
-
│ │ │ └── state.py # Shared state schema
|
| 66 |
-
│ │ ├── api/v1/ # 6 REST endpoint modules
|
| 67 |
-
│ │ ├── llm/provider.py # Provider-agnostic LLM factory
|
| 68 |
-
│ │ ├── prompts/ # 7 system/user prompt templates
|
| 69 |
-
│ │ ├── schemas/ # Pydantic request/response models
|
| 70 |
-
│ │ ├── services/ # DB operations + GitHub analyzer
|
| 71 |
-
│ │ ├── config.py # Env-based settings (validated)
|
| 72 |
-
│ │ ├── database.py # Supabase async client
|
| 73 |
-
│ │ ├── logging_config.py # Structured JSON logging
|
| 74 |
-
│ │ ├── main.py # App factory + middleware stack
|
| 75 |
-
│ │ ├── monitoring.py # Health checks + Prometheus metrics
|
| 76 |
-
│ │ └── security.py # CORS, rate limiting, security headers
|
| 77 |
-
│ ├── migrations/ # 4 SQL schema migrations
|
| 78 |
-
│ ├── tests/ # 171 pytest tests (10 modules)
|
| 79 |
-
│ ├── Dockerfile
|
| 80 |
-
│ ├── gunicorn.conf.py
|
| 81 |
-
│ └── requirements.txt
|
| 82 |
-
├── frontend/
|
| 83 |
-
│ ├── src/
|
| 84 |
-
│ │ ├── app/
|
| 85 |
-
│ │ │ ├── page.tsx # Landing page (WebGL + animations)
|
| 86 |
-
│ │ │ └── dashboard/ # 8 authenticated routes
|
| 87 |
-
│ │ │ ├── analyze/ # JD analysis form
|
| 88 |
-
│ │ │ ├── results/[id]/ # Analysis results + capstones
|
| 89 |
-
│ │ │ ├── repo/ # Repo analyzer + results
|
| 90 |
-
│ │ │ ├── scaffold/ # Scaffold generator + viewer
|
| 91 |
-
│ │ │ ├── portfolio/ # Portfolio optimizer output
|
| 92 |
-
│ │ │ ├── fitness/ # Resume fitness scorer
|
| 93 |
-
│ │ │ ├── projects/ # Saved projects overview
|
| 94 |
-
│ │ │ └── profile/ # User profile + avatar
|
| 95 |
-
│ │ ├── components/ # Auth, landing (WebGL), UI primitives
|
| 96 |
-
│ │ ├── lib/ # API client, Supabase client, utils
|
| 97 |
-
│ │ └── middleware.ts # Route protection
|
| 98 |
-
│ ├── Dockerfile
|
| 99 |
-
│ └── package.json
|
| 100 |
-
├── .github/workflows/ci.yml # 4-job CI/CD pipeline
|
| 101 |
-
├── Makefile # Dev/test/lint shortcuts
|
| 102 |
-
└── DEPLOY.md # Production deployment guide
|
| 103 |
-
```
|
| 104 |
-
|
| 105 |
-
## License
|
| 106 |
-
|
| 107 |
-
MIT
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Shortlist
|
| 3 |
+
emoji: 🎯
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Shortlist — AI-Powered Portfolio Architect API
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
Backend API for Shortlist — an AI agent system that reverse-engineers what recruiters look for, then helps you build exactly that.
|
| 14 |
|
| 15 |
+
## Endpoints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
| Endpoint | Description |
|
| 18 |
+
|---|---|
|
| 19 |
+
| `GET /health` | Health check |
|
| 20 |
+
| `GET /health/deep` | Deep health check (DB + LLM) |
|
| 21 |
+
| `GET /docs` | Swagger UI |
|
| 22 |
+
| `POST /api/v1/jd/analyze` | JD Analysis |
|
| 23 |
+
| `POST /api/v1/capstone/generate` | Capstone Project Generator |
|
| 24 |
+
| `POST /api/v1/repo/analyze` | GitHub Repo Analyzer |
|
| 25 |
+
| `POST /api/v1/scaffold/generate` | Scaffold Generator |
|
| 26 |
+
| `POST /api/v1/portfolio/optimize` | Portfolio Optimizer |
|
| 27 |
+
| `POST /api/v1/fitness/score` | Resume Fitness Scorer |
|
| 28 |
|
| 29 |
## Tech Stack
|
| 30 |
|
| 31 |
+
- **FastAPI** + Pydantic v2
|
| 32 |
+
- **LangGraph** + langchain-groq (Llama 3.3 70B)
|
| 33 |
+
- **Supabase** (PostgreSQL + Auth + RLS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|