-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.docker
More file actions
141 lines (124 loc) · 4.15 KB
/
Makefile.docker
File metadata and controls
141 lines (124 loc) · 4.15 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# RynnMotion Docker Development Makefile
# Usage: make -f Makefile.docker <target>
# Or create alias: alias dmake='make -f Makefile.docker'
.PHONY: help build run exec stop clean rebuild logs shell test
# Default target
help:
@echo "RynnMotion Docker Development Commands"
@echo "======================================="
@echo ""
@echo "Quick Start:"
@echo " make -f Makefile.docker build - Build Docker image"
@echo " make -f Makefile.docker run - Run container and enter shell"
@echo " make -f Makefile.docker shell - Enter running container"
@echo ""
@echo "Development:"
@echo " make -f Makefile.docker exec CMD='<command>' - Execute command in container"
@echo " make -f Makefile.docker test - Run tests in container"
@echo " make -f Makefile.docker build-project - Build RynnMotion in container"
@echo ""
@echo "Management:"
@echo " make -f Makefile.docker logs - View container logs"
@echo " make -f Makefile.docker stop - Stop container"
@echo " make -f Makefile.docker clean - Remove container and volumes"
@echo " make -f Makefile.docker rebuild - Clean rebuild (no cache)"
@echo ""
@echo "Tip: Create an alias for easier usage:"
@echo " alias dmake='make -f Makefile.docker'"
@echo ""
# Build the Docker image
build:
@echo "Building RynnMotion Docker image..."
docker-compose build rynnmotion-dev
@echo "✓ Build complete!"
# Rebuild without cache
rebuild:
@echo "Rebuilding RynnMotion Docker image (no cache)..."
docker-compose build --no-cache rynnmotion-dev
@echo "✓ Rebuild complete!"
# Run container and enter interactive shell
run:
@echo "Starting RynnMotion development container..."
@./scripts/docker-run.sh
# Enter shell in running container
shell:
@echo "Entering container shell..."
@docker exec -it rynnmotion-dev /bin/bash || echo "Error: Container not running. Use 'make run' first."
# Execute command in container
exec:
@docker exec -it rynnmotion-dev bash -c "$(CMD)" || echo "Error: Container not running. Use 'make run' first."
# Stop container
stop:
@echo "Stopping RynnMotion container..."
docker-compose down
@echo "✓ Container stopped"
# Clean up containers and volumes
clean:
@echo "Removing RynnMotion containers and volumes..."
@read -p "This will delete build artifacts and venv. Continue? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
docker-compose down -v; \
echo "✓ Cleanup complete"; \
else \
echo "Cancelled"; \
fi
# View logs
logs:
docker-compose logs -f rynnmotion-dev
# Build RynnMotion project inside container
build-project:
@echo "Building RynnMotion C++ libraries..."
@docker exec -it rynnmotion-dev bash -c " \
mkdir -p /workspace/build && \
cd /workspace/build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j\$$(nproc) \
"
@echo "✓ Build complete!"
# Install Python package
install-python:
@echo "Installing RynnMotion Python package..."
@docker exec -it rynnmotion-dev bash -c " \
cd /workspace/python && \
python3 -m venv venv && \
. venv/bin/activate && \
pip install -e '.[dev]' \
"
@echo "✓ Python package installed!"
# Run tests
test:
@echo "Running RynnMotion tests..."
@docker exec -it rynnmotion-dev bash -c " \
cd /workspace/build && \
ctest --output-on-failure \
"
# Start Jupyter
jupyter:
@echo "Starting Jupyter Lab..."
docker-compose --profile jupyter up -d rynnmotion-jupyter
@echo "✓ Jupyter Lab running at http://localhost:8888"
# Stop Jupyter
jupyter-stop:
docker-compose --profile jupyter down
# Format code
format:
@echo "Formatting C++ code..."
@docker exec -it rynnmotion-dev bash -c " \
find /workspace/src -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i \
"
@echo "✓ Code formatted!"
# Complete setup (build image + build project + install Python)
setup: build
@echo "Running complete setup..."
@make -f Makefile.docker build-project
@make -f Makefile.docker install-python
@echo ""
@echo "=========================================="
@echo "✓ RynnMotion setup complete!"
@echo "=========================================="
@echo ""
@echo "Next steps:"
@echo " make -f Makefile.docker shell - Enter container"
@echo " make -f Makefile.docker test - Run tests"
@echo ""