|
|
@@ -1,8 +1,35 @@
|
|
1
|
1
|
#!/bin/bash
|
|
|
2
|
+set -e
|
|
2
|
3
|
|
|
3
|
|
-FILE_NAME="docker-compose-dev.yaml"
|
|
4
|
|
-
|
|
|
4
|
+# Define Docker Compose file and cache option
|
|
|
5
|
+COMPOSE_FILE_NAME="docker-compose-dev.yaml"
|
|
|
6
|
+CACHE=""
|
|
|
7
|
+# Uncomment the next line to enable no-cache option
|
|
5
|
8
|
# CACHE="--no-cache"
|
|
6
|
9
|
|
|
7
|
|
-docker compose -f ${FILE_NAME} build ${CACHE}
|
|
8
|
|
-docker compose -f ${FILE_NAME} up -d
|
|
|
10
|
+# Define the base Docker Compose command
|
|
|
11
|
+DCS="docker compose -f ${COMPOSE_FILE_NAME}"
|
|
|
12
|
+
|
|
|
13
|
+# Function to build and start services
|
|
|
14
|
+build_and_run() {
|
|
|
15
|
+ echo "Building services..."
|
|
|
16
|
+ if ! $DCS build ${CACHE}; then
|
|
|
17
|
+ echo "Error: Failed to build services"
|
|
|
18
|
+ exit 1
|
|
|
19
|
+ fi
|
|
|
20
|
+
|
|
|
21
|
+ echo "Starting services..."
|
|
|
22
|
+ if ! $DCS up -d; then
|
|
|
23
|
+ echo "Error: Failed to start services"
|
|
|
24
|
+ exit 1
|
|
|
25
|
+ fi
|
|
|
26
|
+ echo "Services started successfully"
|
|
|
27
|
+ echo "If you want to stop the services, run"
|
|
|
28
|
+ echo "docker compose -f ${COMPOSE_FILE_NAME} down"
|
|
|
29
|
+
|
|
|
30
|
+ echo "If you want to see the logs, run"
|
|
|
31
|
+ echo "docker compose -f ${COMPOSE_FILE_NAME} logs -f"
|
|
|
32
|
+}
|
|
|
33
|
+
|
|
|
34
|
+# Execute build and start function
|
|
|
35
|
+build_and_run
|