forked from QACTrainers/LBG-Python-API-Base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
41 lines (41 loc) · 1005 Bytes
/
setup.sh
File metadata and controls
41 lines (41 loc) · 1005 Bytes
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
#!/bin/bash
# Exit script if any command fails
set -e
# Define Docker image name
DOCKER_IMAGE="lbg/1.0"
cleanup() {
echo "Cleaning up previous build artifacts..."
sleep 3
# Add commands to clean up previous build artifacts
docker rm -f $(docker ps -aq) || true
docker rmi -f $(docker images) || true
echo "Cleanup done."
}
# Function to build the Docker image
build_docker() {
echo "Building the Docker image..."
sleep 3
docker build -t $DOCKER_IMAGE .
}
# Function to modify the application
modify_app() {
echo "Modifying the application..."
sleep 3
export PORT=5001
echo "Modifications done. Port is now set to $PORT"
}
# Function to run the Docker container
run_docker() {
echo "Running Docker container..."
sleep 3
docker run -d -p 80:$PORT -e PORT=$PORT $DOCKER_IMAGE
}
# Main script execution
echo "Starting build process..."
sleep 3
cleanup
build_docker
modify_app
build_docker
run_docker
echo "Build process completed successfully."