Skip to content

Commit 6992a62

Browse files
committed
Added Next.js BE & FE
1 parent 7c414fb commit 6992a62

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

manage_app.sh

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
# Define the docker-compose file location
4+
COMPOSE_FILE="docker-compose.yml"
5+
6+
# Display help message
7+
function show_help() {
8+
echo "Usage: $0 [option]"
9+
echo "Options:"
10+
echo " build Build the backend and frontend Docker images"
11+
echo " start Start all services (backend, frontend, firebase)"
12+
echo " stop Stop all services"
13+
echo " restart Restart all services"
14+
echo " logs Show logs for all services"
15+
echo " logs-backend Show logs for the backend service"
16+
echo " logs-frontend Show logs for the frontend service"
17+
echo " logs-firebase Show logs for the firebase service"
18+
echo " clean Stop and remove all containers, networks, and volumes"
19+
echo " help Display this help message"
20+
}
21+
22+
# Check if docker-compose file exists
23+
if [ ! -f "$COMPOSE_FILE" ]; then
24+
echo "Error: $COMPOSE_FILE not found!"
25+
exit 1
26+
fi
27+
28+
# Handle script arguments
29+
case "$1" in
30+
build)
31+
echo "Building Docker images for backend and frontend..."
32+
docker-compose -f $COMPOSE_FILE build
33+
;;
34+
start)
35+
echo "Starting all services..."
36+
docker-compose -f $COMPOSE_FILE up -d
37+
;;
38+
stop)
39+
echo "Stopping all services..."
40+
docker-compose -f $COMPOSE_FILE down
41+
;;
42+
restart)
43+
echo "Restarting all services..."
44+
docker-compose -f $COMPOSE_FILE down
45+
docker-compose -f $COMPOSE_FILE up -d
46+
;;
47+
logs)
48+
echo "Displaying logs for all services..."
49+
docker-compose -f $COMPOSE_FILE logs -f
50+
;;
51+
logs-backend)
52+
echo "Displaying logs for the backend service..."
53+
docker-compose -f $COMPOSE_FILE logs -f backend
54+
;;
55+
logs-frontend)
56+
echo "Displaying logs for the frontend service..."
57+
docker-compose -f $COMPOSE_FILE logs -f frontend
58+
;;
59+
logs-firebase)
60+
echo "Displaying logs for the firebase service..."
61+
docker-compose -f $COMPOSE_FILE logs -f firebase
62+
;;
63+
clean)
64+
echo "Cleaning up: stopping and removing all containers, networks, and volumes..."
65+
docker-compose -f $COMPOSE_FILE down -v --remove-orphans
66+
;;
67+
help)
68+
show_help
69+
;;
70+
*)
71+
echo "Invalid option!"
72+
show_help
73+
;;
74+
esac

0 commit comments

Comments
 (0)