Skip to content

Commit c5f7a9d

Browse files
committed
misc
1 parent 31a333c commit c5f7a9d

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

Makefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ FRONTEND_DIR := frontend
55
PYTHON ?= python3
66
FRONTEND_IMAGE_LOCAL := local/global-tsunami-risk-map-frontend:latest
77
FRONTEND_IMAGE_REMOTE := ghcr.io/yejiyang/global-tsunami-risk-map-frontend:latest
8+
LOCAL ?= false # Set to 'true' to build and run with the local frontend image
89

910
.PHONY: help docker-build docker-up docker-down docker-logs docker-clean \
1011
docker-up-% docker-rebuild-% frontend-build frontend-serve \
@@ -52,15 +53,22 @@ docker-build-frontend: ## Build local frontend Docker image
5253
@echo "Building local frontend Docker image..."
5354
docker build -t $(FRONTEND_IMAGE_LOCAL) ./$(FRONTEND_DIR)
5455

55-
docker-run-local: docker-build-frontend ## Run with locally built frontend image
56-
@echo "Running with local frontend image..."
57-
USE_LOCAL_BUILD=$(FRONTEND_IMAGE_LOCAL) $(COMPOSE) up -d
58-
59-
docker-run: ## Run with remote frontend image from GitHub
60-
@echo "Running with remote frontend image from GitHub..."
61-
@echo "Pulling latest frontend image..."
62-
docker pull $(FRONTEND_IMAGE_REMOTE)
63-
$(COMPOSE) up -d
56+
# Unified run target (use LOCAL=true to prefer the locally-built frontend image)
57+
docker-run: ## Run the stack (use LOCAL=true for local frontend build)
58+
@if [ "$(LOCAL)" = "true" ]; then \
59+
echo "Building and running with local frontend image..."; \
60+
$(MAKE) docker-build-frontend; \
61+
USE_LOCAL_BUILD=$(FRONTEND_IMAGE_LOCAL) $(COMPOSE) up -d; \
62+
else \
63+
echo "Running with remote frontend image from GitHub..."; \
64+
echo "Pulling latest frontend image..."; \
65+
docker pull $(FRONTEND_IMAGE_REMOTE); \
66+
$(COMPOSE) up -d; \
67+
fi
68+
69+
# Backwards-compatibility alias
70+
docker-run-local: ## Alias for 'LOCAL=true make docker-run'
71+
@$(MAKE) LOCAL=true docker-run
6472

6573
# Frontend development helpers
6674
frontend-build: ## Build frontend assets

0 commit comments

Comments
 (0)