-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
121 lines (102 loc) · 3.76 KB
/
Makefile
File metadata and controls
121 lines (102 loc) · 3.76 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Makefile for OIF Aggregator Docker operations
.PHONY: help build-dev build-dev-clean build-prod build-prod-clean run-dev run-dev-bg run-prod run-prod-bg logs-dev logs-prod stop-dev stop-prod clean test-dev shell-dev rebuild-dev dev up down
# Default target
help:
@echo "OIF Aggregator Docker Commands (using Chainguard secure images):"
@echo ""
@echo "⚡ Quick Start (Development):"
@echo " dev - Start development environment"
@echo " up - Start development in background"
@echo " down - Stop development environment"
@echo ""
@echo "🚀 Development Commands:"
@echo " run-dev - Run development environment"
@echo " run-dev-bg - Run development environment in background"
@echo " stop-dev - Stop development containers"
@echo " logs-dev - View development logs"
@echo " test-dev - Run tests in development container"
@echo " shell-dev - Shell access to development container"
@echo " rebuild-dev - Rebuild development environment"
@echo ""
@echo "🏭 Production Commands:"
@echo " run-prod - Run production environment"
@echo " run-prod-bg - Run production environment in background"
@echo " stop-prod - Stop production containers"
@echo " logs-prod - View production logs"
@echo ""
@echo "📦 Build Commands:"
@echo " build-dev - Build development Docker image"
@echo " build-dev-clean - Build development image without cache"
@echo " build-prod - Build production Docker image"
@echo " build-prod-clean - Build production image without cache"
@echo ""
@echo "🧹 Cleanup:"
@echo " clean - Remove containers and images"
@echo ""
@echo ""
# Build development image (with cargo-chef optimization)
build-dev:
docker build -f Dockerfile.dev -t oif-aggregator:dev .
# Build development image without cache
build-dev-clean:
docker build --no-cache -f Dockerfile.dev -t oif-aggregator:dev .
# Build production image (with cargo-chef optimization)
build-prod:
docker build -t oif-aggregator:latest .
# Build production image without cache (clean build)
build-prod-clean:
docker build --no-cache -t oif-aggregator:latest .
# Run development environment
run-dev:
docker compose up
# Run development environment in background
run-dev-bg:
docker compose up -d
# Run production environment
run-prod:
@if [ -z "$(INTEGRITY_SECRET)" ]; then \
echo "Error: INTEGRITY_SECRET environment variable is required"; \
echo "Usage: INTEGRITY_SECRET=your-secret make run-prod"; \
exit 1; \
fi
docker compose -f docker-compose.prod.yml up
# Run production environment in background
run-prod-bg:
@if [ -z "$(INTEGRITY_SECRET)" ]; then \
echo "Error: INTEGRITY_SECRET environment variable is required"; \
echo "Usage: INTEGRITY_SECRET=your-secret make run-prod-bg"; \
exit 1; \
fi
docker compose -f docker-compose.prod.yml up -d
# View development logs
logs-dev:
docker compose logs -f
# View production logs
logs-prod:
docker compose -f docker-compose.prod.yml logs -f
# Stop development containers
stop-dev:
docker compose down
# Stop production containers
stop-prod:
docker compose -f docker-compose.prod.yml down
# Clean up containers and images
clean:
docker compose down -v --rmi all
docker compose -f docker-compose.prod.yml down -v --rmi all 2>/dev/null || true
docker system prune -f
# Run tests in development container
test-dev:
docker compose exec oif-aggregator cargo test
# Shell access to development container
shell-dev:
docker compose exec oif-aggregator bash
# Rebuild development environment
rebuild-dev:
docker compose down
docker compose build --no-cache
docker compose up
# ⚡ Quick aliases for common development tasks
dev: run-dev
up: run-dev-bg
down: stop-dev