-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-dev.sh
More file actions
60 lines (56 loc) · 1.46 KB
/
docker-dev.sh
File metadata and controls
60 lines (56 loc) · 1.46 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
#!/bin/bash
# Script to run Docker Compose commands for development
# Function to display help message
show_help() {
echo "Usage: ./docker-dev.sh [COMMAND]"
echo ""
echo "Commands:"
echo " up Start the development environment"
echo " down Stop the development environment"
echo " build Build the Docker images"
echo " logs View the logs of the running containers"
echo " frontend Access a shell in the frontend container"
echo " backend Access a shell in the backend container"
echo " help Display this help message"
echo ""
}
# Check if a command was provided
if [ $# -eq 0 ]; then
show_help
exit 1
fi
# Process the command
case "$1" in
up)
echo "Starting the development environment..."
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d
;;
down)
echo "Stopping the development environment..."
docker-compose down
;;
build)
echo "Building the Docker images..."
docker-compose -f docker-compose.yml -f docker-compose.override.yml build
;;
logs)
echo "Viewing the logs of the running containers..."
docker-compose logs -f
;;
frontend)
echo "Accessing a shell in the frontend container..."
docker-compose exec frontend sh
;;
backend)
echo "Accessing a shell in the backend container..."
docker-compose exec backend sh
;;
help)
show_help
;;
*)
echo "Unknown command: $1"
show_help
exit 1
;;
esac