wrongmove/.claude/skills/build-and-push.md
Viktor Barzin 150342bb9e
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)
2026-02-07 20:19:57 +00:00

3.2 KiB

name description author version date
build-and-push 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. Claude Code 1.0.0 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

docker build -t viktorbarzin/realestatecrawler:latest crawler/

Build Frontend image

docker build -t viktorbarzin/immoweb:latest crawler/frontend/

Build both

docker build -t viktorbarzin/realestatecrawler:latest crawler/ && \
docker build -t viktorbarzin/immoweb:latest crawler/frontend/
# 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)

docker login -u viktorbarzin

Push API image

docker push viktorbarzin/realestatecrawler:latest

Push Frontend image

docker push viktorbarzin/immoweb:latest

Push with specific tag

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)

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