All checks were successful
Build and Push / build (push) Successful in 13s
- Replace split setup (ratings_server.py on :8081 + http.server on :8080) with a single combined Flask server (server.py) on :8080 that serves static files and the /api/ratings GET/POST endpoints - Ratings are now persisted server-side: mapa_bytu.html loads ratings from GET /api/ratings on startup (API as source of truth) and POSTs on every change — enables cross-browser and cross-device state sharing while keeping localStorage as a synchronous read cache - Dockerfile: install flask, copy server.py instead of ratings_server.py, expose only port 8080 - entrypoint.sh: start single server process instead of two - Makefile: add serve / serve-debug targets for local development - scrape_psn.py: fix log label, add --max-pages stub arg for CLI parity - Refresh all scraped property data Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
80 lines
2.8 KiB
Makefile
80 lines
2.8 KiB
Makefile
IMAGE_NAME := maru-hleda-byt
|
|
CONTAINER_NAME := maru-hleda-byt
|
|
VOLUME_NAME := maru-hleda-byt-data
|
|
VALIDATION_CONTAINER := maru-hleda-byt-validation
|
|
VALIDATION_VOLUME := maru-hleda-byt-validation-data
|
|
PORT := 8080
|
|
|
|
.PHONY: build run stop logs scrape restart clean help validation validation-local validation-stop validation-local-debug serve serve-debug
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " build - Build the Docker image"
|
|
@echo " run - Build and run the Docker container in the background"
|
|
@echo " stop - Stop and remove the running container"
|
|
@echo " logs - Show live container logs"
|
|
@echo " scrape - Run the scraping script inside the container"
|
|
@echo " validation - Run scraping with limits (1 page, 10 properties) in Docker container"
|
|
@echo " validation-stop - Stop the validation Docker container"
|
|
@echo " validation-local - Run scraping with limits (1 page, 10 properties) locally with Python"
|
|
@echo " validation-local-debug - Run validation locally with DEBUG logging"
|
|
@echo " restart - Restart the container (stop and run again)"
|
|
@echo " clean - Stop container and remove the Docker image"
|
|
@echo " serve - Run server.py locally (DATA_DIR=., port $(PORT))"
|
|
@echo " serve-debug - Run server.py locally with DEBUG logging"
|
|
@echo " help - Show this help message"
|
|
|
|
build:
|
|
docker build -f build/Dockerfile -t $(IMAGE_NAME) .
|
|
|
|
run: build
|
|
docker run -d --name $(CONTAINER_NAME) \
|
|
-p $(PORT):8080 \
|
|
-v $(VOLUME_NAME):/app/data \
|
|
--restart unless-stopped \
|
|
$(IMAGE_NAME)
|
|
@echo "Map will be at http://localhost:$(PORT)/mapa_bytu.html"
|
|
|
|
stop:
|
|
docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME)
|
|
|
|
logs:
|
|
docker logs -f $(CONTAINER_NAME)
|
|
|
|
scrape:
|
|
docker exec $(CONTAINER_NAME) bash /app/run_all.sh
|
|
|
|
validation: build
|
|
@docker stop $(VALIDATION_CONTAINER) 2>/dev/null || true
|
|
@docker rm $(VALIDATION_CONTAINER) 2>/dev/null || true
|
|
docker run -d --name $(VALIDATION_CONTAINER) \
|
|
-p 8081:8080 \
|
|
-v $(VALIDATION_VOLUME):/app/data \
|
|
--restart unless-stopped \
|
|
$(IMAGE_NAME)
|
|
@sleep 2
|
|
docker exec $(VALIDATION_CONTAINER) bash /app/run_all.sh --max-pages 1 --max-properties 10
|
|
@echo "Validation map will be at http://localhost:8081/mapa_bytu.html"
|
|
|
|
validation-stop:
|
|
@docker stop $(VALIDATION_CONTAINER) 2>/dev/null || true
|
|
@docker rm $(VALIDATION_CONTAINER) 2>/dev/null || true
|
|
@echo "Validation container stopped and removed"
|
|
|
|
validation-local:
|
|
./run_all.sh --max-pages 1 --max-properties 10
|
|
|
|
validation-local-debug:
|
|
./run_all.sh --max-pages 1 --max-properties 10 --log-level DEBUG
|
|
|
|
serve:
|
|
DATA_DIR=. PORT=$(PORT) python server.py
|
|
|
|
serve-debug:
|
|
DATA_DIR=. PORT=$(PORT) python server.py --verbose
|
|
|
|
restart: stop run
|
|
|
|
clean: stop
|
|
docker rmi $(IMAGE_NAME)
|