-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-monster.sh
More file actions
executable file
Β·168 lines (144 loc) Β· 4.71 KB
/
start-monster.sh
File metadata and controls
executable file
Β·168 lines (144 loc) Β· 4.71 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
# C++ Heavy Development Environment Launcher (Shell Script)
# Alternative launcher for systems without VS Code or for advanced users
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo -e "${CYAN}$1${NC}"
}
# Help function
show_help() {
print_header "π C++ Heavy Development Environment Launcher"
print_header "=============================================="
echo ""
echo "Usage:"
echo " $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " -r, --rebuild Rebuild the container before launching"
echo " -s, --shell Launch container with shell instead of VS Code"
echo " -d, --daemon Run container in daemon mode"
echo ""
echo "Examples:"
echo " $0 # Launch with VS Code"
echo " $0 --shell # Launch container with bash shell"
echo " $0 --rebuild --shell # Rebuild and launch with shell"
echo ""
}
# Parse arguments
REBUILD=false
SHELL_MODE=false
DAEMON_MODE=false
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
show_help
exit 0
;;
-r|--rebuild)
REBUILD=true
shift
;;
-s|--shell)
SHELL_MODE=true
shift
;;
-d|--daemon)
DAEMON_MODE=true
shift
;;
*)
print_error "Unknown option: $1"
show_help
exit 1
;;
esac
done
print_header "π C++ Heavy Development Environment"
print_header "===================================="
# Check if Docker is running
print_info "Checking Docker status..."
if ! docker info > /dev/null 2>&1; then
print_error "Docker is not running. Please start Docker first."
exit 1
fi
print_success "Docker is running"
# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
# Rebuild if requested
if [ "$REBUILD" = true ]; then
print_info "Rebuilding container..."
docker-compose -f .devcontainer/docker-compose.yml build --no-cache
print_success "Container rebuilt successfully"
fi
# Launch based on mode
if [ "$SHELL_MODE" = true ]; then
print_info "π Launching container with bash shell..."
# Start container if not running
docker-compose -f .devcontainer/docker-compose.yml up -d
# Execute bash in the container
print_success "Container started. Entering bash shell..."
print_info "Type 'exit' to leave the container"
print_info ""
print_info "π Quick commands inside container:"
print_info " cd /workspace/projects/sample-cpp # Go to sample project"
print_info " ./build.sh # Build sample project"
print_info " htop # System monitor"
print_info " gcc --version # Check compiler version"
print_info ""
docker-compose -f .devcontainer/docker-compose.yml exec cppbench bash
elif [ "$DAEMON_MODE" = true ]; then
print_info "π Starting container in daemon mode..."
docker-compose -f .devcontainer/docker-compose.yml up -d
print_success "Container is running in the background"
print_info "Connect with: docker-compose -f .devcontainer/docker-compose.yml exec cppbench bash"
else
# Default VS Code mode
if ! command -v code &> /dev/null; then
print_warning "VS Code not found. Falling back to shell mode..."
SHELL_MODE=true
exec "$0" --shell
fi
print_info "π Launching VS Code devcontainer..."
code .
print_success "VS Code launched!"
fi
print_success "C++ Heavy Development Environment ready! π οΈ"
if [ "$SHELL_MODE" != true ]; then
echo ""
print_header "π Quick Start Guide:"
echo " 1. Wait for container to build (first time only)"
echo " 2. Open terminal in VS Code"
echo " 3. Navigate to sample: cd /workspace/projects/sample-cpp"
echo " 4. Build sample: ./build.sh"
echo ""
print_header "π§ Environment Features:"
echo " β’ GCC 12 and Clang 15 compilers"
echo " β’ CMake and Ninja build systems"
echo " β’ vcpkg and Conan package managers"
echo " β’ Debugging and profiling tools"
echo " β’ Static analysis tools"
echo " β’ Google Test framework"
echo ""
print_warning "For troubleshooting, see .devcontainer/BUILD_FIXES.md"
fi