-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (53 loc) · 2.55 KB
/
Makefile
File metadata and controls
65 lines (53 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Docker image settings
DOCKER_REPO_API := aorwall/moatless-api
VERSION := $(shell git describe --tags --always --dirty || echo latest)
DOCKER_TAG ?= latest
PLATFORMS := linux/amd64,linux/arm64
# Docker Compose settings
DOCKER_DIR := docker
API_DOCKERFILE := $(DOCKER_DIR)/Dockerfile.api
COMPOSE_FILE := docker-compose.yml
# Environment file
ENV_FILE ?= .env
.PHONY: help build-api build-multiarch run dev stop logs status restart-api
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo ''
@echo 'Environment:'
@echo ' ENV_FILE=<file> Use a specific environment file (default: .env)'
run: ## Start all services with docker-compose
@if ! grep -q "^MOATLESS_DIR=" ${ENV_FILE} 2>/dev/null || [ -z "$$(grep "^MOATLESS_DIR=" ${ENV_FILE} 2>/dev/null | cut -d'=' -f2)" ]; then \
echo "Error: MOATLESS_DIR is not set in ${ENV_FILE}"; \
echo "Please add MOATLESS_DIR=/path/to/your/moatless/data to ${ENV_FILE}"; \
echo "This directory will store Moatless configuration and trajectory data."; \
exit 1; \
fi; \
$(eval DETECTED_ARCH := $(shell uname -m | sed 's/x86_64/amd64/')) \
echo "Starting all services for $(DETECTED_ARCH) with environment: ${ENV_FILE}..."; \
DOCKER_DEFAULT_PLATFORM=linux/$(DETECTED_ARCH) docker-compose --env-file ${ENV_FILE} -f $(COMPOSE_FILE) up -d
stop: ## Stop all services
echo "Stopping services..."; \
docker-compose --env-file ${ENV_FILE} -f $(COMPOSE_FILE) down
restart-api: ## Restart only the API service
echo "Restarting API service with environment: ${ENV_FILE}..."; \
docker-compose --env-file ${ENV_FILE} -f $(COMPOSE_FILE) restart api
logs: ## Show logs from all services
docker-compose --env-file ${ENV_FILE} -f $(COMPOSE_FILE) logs -f
status: ## Show status of all services
docker-compose --env-file ${ENV_FILE} -f $(COMPOSE_FILE) ps
build-api: ## Build API Docker image only
$(eval TARGETPLATFORM := linux/$(shell uname -m | sed 's/x86_64/amd64/'))
@echo "Building API Docker image with platform: $(TARGETPLATFORM) and tag: $(DOCKER_TAG)"
docker build -f $(API_DOCKERFILE) \
--platform $(TARGETPLATFORM) \
--build-arg TARGETPLATFORM=$(TARGETPLATFORM) \
-t $(DOCKER_REPO_API):$(DOCKER_TAG) \
--no-cache .
build-multiarch: ## Build multi-architecture Docker images for both UI and API
@echo "Building multi-architecture Docker images with tag: $(DOCKER_TAG)"
docker buildx build --platform $(PLATFORMS) -f $(API_DOCKERFILE) \
-t $(DOCKER_REPO_API):$(DOCKER_TAG) \
--push .