Refactor codebase following Clean Code principles and add 229 tests
- Extract helpers to reduce function sizes (listing_tasks, app.py, query.py, listing_fetcher) - Replace nonlocal mutations with _PipelineState dataclass in listing_tasks - Fix bugs: isinstance→equality check in repository, verify_exp for OIDC tokens - Consolidate duplicate filter methods in listing_repository - Move hardcoded config to env vars with backward-compatible defaults - Simplify CLI decorator to auto-build QueryParameters - Add deprecation docstring to data_access.py - Test count: 158 → 387 (all passing)
This commit is contained in:
parent
7e05b3c971
commit
150342bb9e
48 changed files with 5029 additions and 990 deletions
113
.claude/skills/build-and-push.md
Normal file
113
.claude/skills/build-and-push.md
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
name: build-and-push
|
||||
description: |
|
||||
Build Docker images for the API and frontend, and push them to Docker Hub.
|
||||
Use when: (1) user wants to build new Docker images locally, (2) push images
|
||||
to the registry before deploying, (3) tag images for a release. Covers both
|
||||
the Python/FastAPI backend and the React/Nginx frontend.
|
||||
author: Claude Code
|
||||
version: 1.0.0
|
||||
date: 2026-02-06
|
||||
---
|
||||
|
||||
# Build and Push Docker Images
|
||||
|
||||
All commands run locally. Images are pushed to Docker Hub under the `viktorbarzin` namespace.
|
||||
|
||||
## Image Registries
|
||||
|
||||
| Component | Docker Hub repo | Dockerfile location |
|
||||
|-----------|------------------------------------|------------------------------|
|
||||
| API | `viktorbarzin/realestatecrawler` | `crawler/Dockerfile` |
|
||||
| Frontend | `viktorbarzin/immoweb` | `crawler/frontend/Dockerfile`|
|
||||
|
||||
## Building Images
|
||||
|
||||
### Build API image
|
||||
|
||||
```bash
|
||||
docker build -t viktorbarzin/realestatecrawler:latest crawler/
|
||||
```
|
||||
|
||||
### Build Frontend image
|
||||
|
||||
```bash
|
||||
docker build -t viktorbarzin/immoweb:latest crawler/frontend/
|
||||
```
|
||||
|
||||
### Build both
|
||||
|
||||
```bash
|
||||
docker build -t viktorbarzin/realestatecrawler:latest crawler/ && \
|
||||
docker build -t viktorbarzin/immoweb:latest crawler/frontend/
|
||||
```
|
||||
|
||||
### Build with a specific tag (recommended for production)
|
||||
|
||||
```bash
|
||||
# Use git commit SHA
|
||||
GIT_SHA=$(git rev-parse --short HEAD)
|
||||
docker build -t viktorbarzin/realestatecrawler:${GIT_SHA} -t viktorbarzin/realestatecrawler:latest crawler/
|
||||
docker build -t viktorbarzin/immoweb:${GIT_SHA} -t viktorbarzin/immoweb:latest crawler/frontend/
|
||||
```
|
||||
|
||||
## Pushing Images
|
||||
|
||||
### Login to Docker Hub (if not already)
|
||||
|
||||
```bash
|
||||
docker login -u viktorbarzin
|
||||
```
|
||||
|
||||
### Push API image
|
||||
|
||||
```bash
|
||||
docker push viktorbarzin/realestatecrawler:latest
|
||||
```
|
||||
|
||||
### Push Frontend image
|
||||
|
||||
```bash
|
||||
docker push viktorbarzin/immoweb:latest
|
||||
```
|
||||
|
||||
### Push with specific tag
|
||||
|
||||
```bash
|
||||
GIT_SHA=$(git rev-parse --short HEAD)
|
||||
docker push viktorbarzin/realestatecrawler:${GIT_SHA}
|
||||
docker push viktorbarzin/realestatecrawler:latest
|
||||
docker push viktorbarzin/immoweb:${GIT_SHA}
|
||||
docker push viktorbarzin/immoweb:latest
|
||||
```
|
||||
|
||||
## Build and Push Everything (Full Release)
|
||||
|
||||
```bash
|
||||
GIT_SHA=$(git rev-parse --short HEAD)
|
||||
|
||||
# Build
|
||||
docker build -t viktorbarzin/realestatecrawler:${GIT_SHA} -t viktorbarzin/realestatecrawler:latest crawler/
|
||||
docker build -t viktorbarzin/immoweb:${GIT_SHA} -t viktorbarzin/immoweb:latest crawler/frontend/
|
||||
|
||||
# Push
|
||||
docker push viktorbarzin/realestatecrawler:${GIT_SHA}
|
||||
docker push viktorbarzin/realestatecrawler:latest
|
||||
docker push viktorbarzin/immoweb:${GIT_SHA}
|
||||
docker push viktorbarzin/immoweb:latest
|
||||
```
|
||||
|
||||
## CI/CD Note
|
||||
|
||||
Drone CI automatically builds and pushes images on push to `master` (see `.drone.yml`).
|
||||
The manual process above is for when you need to build/push outside of CI, such as:
|
||||
- Hotfix deployments
|
||||
- Testing image builds locally before pushing
|
||||
- Deploying from a non-master branch
|
||||
|
||||
## Notes
|
||||
|
||||
- The API Dockerfile installs system deps (OpenCV, Tesseract, MariaDB client) and Python deps via Poetry
|
||||
- The Frontend Dockerfile is a multi-stage build: Node builder -> Nginx runtime
|
||||
- Always tag with both `:latest` and a specific tag (git SHA or version) for traceability
|
||||
- Use `docker buildx` for cross-platform builds if deploying to ARM nodes
|
||||
Loading…
Add table
Add a link
Reference in a new issue