-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·53 lines (47 loc) · 1.26 KB
/
start.sh
File metadata and controls
executable file
·53 lines (47 loc) · 1.26 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
#!/bin/bash
# Function to show usage
show_help() {
echo "Usage: ./start.sh [OPTIONS]"
echo "Options:"
echo " --build-base Force rebuild of the base image (text2speech-base)"
echo " --detach, -d Run containers in the background"
echo " --help Show this help message"
}
BUILD_BASE=false
DETACH_MODE=""
# Parse arguments
for arg in "$@"; do
case $arg in
--build-base)
BUILD_BASE=true
shift
;;
--detach|-d)
DETACH_MODE="-d"
shift
;;
--help)
show_help
exit 0
;;
esac
done
# Check if base image exists
if [[ "$(docker images -q text2speech-base 2> /dev/null)" == "" ]]; then
echo "Base image 'text2speech-base' not found. Building it now..."
BUILD_BASE=true
fi
# Build base image if requested or missing
if [ "$BUILD_BASE" = true ]; then
echo "Building base image..."
docker build -f Dockerfile.base -t text2speech-base .
if [ $? -ne 0 ]; then
echo "Error: Failed to build base image."
exit 1
fi
else
echo "Using existing base image. Use --build-base to force rebuild."
fi
# Start the application
echo "Starting application..."
docker-compose up --build $DETACH_MODE