-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquick-start.sh
More file actions
executable file
·92 lines (83 loc) · 2.02 KB
/
Copy pathquick-start.sh
File metadata and controls
executable file
·92 lines (83 loc) · 2.02 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
#!/bin/bash
# Print banner
echo "====================================="
echo "Docker Bake Example - Quick Start"
echo "====================================="
echo ""
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "Error: Docker is not running!"
echo "Please start Docker and try again."
exit 1
fi
# Check if buildx is available
if ! docker buildx version > /dev/null 2>&1; then
echo "Warning: Docker Buildx not available."
echo "Docker Bake commands may not work."
else
echo "✅ Docker Buildx is available"
fi
# Set BuildKit environment variables
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
echo "✅ BuildKit enabled"
echo ""
# Ask user what to start
echo "What would you like to do?"
echo "1) Run development environment with Docker Compose"
echo "2) Run production environment with Docker Compose"
echo "3) Build with Docker Bake (HCL)"
echo "4) Run locally without Docker"
echo "q) Quit"
read -p "Enter your choice (1-4 or q): " choice
case $choice in
1)
echo "Starting development environment..."
docker compose up app
;;
2)
echo "Starting production environment..."
docker compose up app-prod
;;
3)
echo "Building with Docker Bake..."
echo "Which target would you like to build?"
echo "1) Development (app-dev)"
echo "2) Production (app-prod)"
echo "3) All targets"
read -p "Enter your choice (1-3): " bake_choice
case $bake_choice in
1)
docker buildx bake -f docker-bake.hcl app-dev
;;
2)
docker buildx bake -f docker-bake.hcl app-prod
;;
3)
docker buildx bake -f docker-bake.hcl all
;;
*)
echo "Invalid choice"
exit 1
;;
esac
;;
4)
echo "Running locally without Docker..."
cd app
if [ ! -d "node_modules" ]; then
echo "Installing dependencies..."
npm install
fi
npm run dev
;;
q)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice"
exit 1
;;
esac
echo "Done!"