-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·55 lines (48 loc) Β· 1.72 KB
/
setup.sh
File metadata and controls
executable file
Β·55 lines (48 loc) Β· 1.72 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
#!/bin/bash
# Get current user info
export USER=$(whoami)
echo "π Starting the Java DevBench Container"
echo " User: $USER"
# Check if the java-bench image exists
if ! docker image inspect "java-bench:$USER" >/dev/null 2>&1; then
echo ""
echo "β Error: Docker image 'java-bench:$USER' not found!"
echo ""
echo "You need to build the Java bench image first:"
echo " ./scripts/build-layer.sh"
echo ""
echo "This will:"
echo " 1. Check that devbench-base:$USER exists (build ../base-image if needed)"
echo " 2. Build the Java-specific layer on top of it"
echo " 3. Install OpenJDK 21, Maven, Gradle, Spring CLI, and SDKMan"
exit 1
fi
# Validate we have the required info
if [ -z "$USER" ]; then
echo "β Error: Could not determine user info"
echo " USER=$USER"
exit 1
fi
echo "π§ Starting container with user mapping..."
# Start the container with proper user mapping (no --build since using pre-built image)
docker-compose -f .devcontainer/docker-compose.yml up -d
if [ $? -eq 0 ]; then
echo "β
Container started successfully!"
echo ""
echo "π― Next steps:"
echo " - Open VS Code and select 'Reopen in Container'"
echo " - Or run: docker exec -it java_bench zsh"
echo ""
echo "π To check container status:"
echo " docker ps | grep java_bench"
echo ""
echo "β Java Development Ready:"
echo " - OpenJDK 21 (LTS)"
echo " - Maven and Gradle build tools"
echo " - Spring Boot CLI"
echo " - SDKMan for version management"
echo " - M2 repository at /workspace/m2repo"
else
echo "β Container failed to start. Check Docker logs:"
echo " docker-compose -f .devcontainer/docker-compose.yml logs"
fi