Skip to content

Commit 6bac25c

Browse files
authored
refactor: improve Makefile with variables (#34)
1 parent 0f95bb8 commit 6bac25c

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

Makefile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Makefile for Geospatial Dataset Publishing project
22

3+
COMPOSE ?= docker compose
4+
FRONTEND_DIR := frontend
5+
PYTHON ?= python3
6+
37
.PHONY: help docker-build docker-up docker-down docker-logs docker-clean docker-rebuild-frontend docker-up-frontend docker-up-backend docker-rebuild-backend frontend-build frontend-serve
48

5-
# Default target
9+
.DEFAULT_GOAL := help
10+
611
help:
712
@echo "Geospatial Dataset Publishing Project"
813
@echo ""
@@ -25,46 +30,46 @@ help:
2530
# Docker commands
2631
docker-build:
2732
@echo "Building Docker images..."
28-
docker-compose build
33+
$(COMPOSE) build
2934

3035
docker-up:
3136
@echo "Starting Docker containers..."
32-
docker-compose up -d
37+
$(COMPOSE) up -d
3338

3439
docker-down:
3540
@echo "Stopping Docker containers..."
36-
docker-compose down
41+
$(COMPOSE) down
3742

3843
docker-logs:
3944
@echo "Viewing Docker logs..."
40-
docker-compose logs -f
45+
$(COMPOSE) logs -f
4146

4247
docker-clean:
4348
@echo "Cleaning Docker resources..."
44-
docker-compose down --rmi all --volumes --remove-orphans
49+
$(COMPOSE) down --rmi all --volumes --remove-orphans
4550

4651
docker-rebuild-frontend:
4752
@echo "Rebuilding frontend Docker container..."
48-
docker-compose build --no-cache frontend
53+
$(COMPOSE) build --no-cache frontend
4954

5055
docker-up-frontend:
5156
@echo "Starting frontend Docker container..."
52-
docker-compose up -d frontend
57+
$(COMPOSE) up -d frontend
5358

5459
docker-up-backend:
5560
@echo "Starting backend Docker container..."
56-
docker-compose up -d backend
61+
$(COMPOSE) up -d backend
5762

5863
# Docker backend-specific commands
5964
docker-rebuild-backend:
6065
@echo "Rebuilding backend Docker container (no cache)..."
61-
docker-compose build --no-cache backend
66+
$(COMPOSE) build --no-cache backend
6267

6368
# Frontend development helpers
6469
frontend-build:
6570
@echo "Building frontend..."
66-
cd frontend && npm run build
71+
cd $(FRONTEND_DIR) && npm run build
6772

6873
frontend-serve:
6974
@echo "Serving frontend locally on http://localhost:8080"
70-
cd frontend/src && python3 -m http.server 8080
75+
cd $(FRONTEND_DIR)/src && $(PYTHON) -m http.server 8080

0 commit comments

Comments
 (0)