-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick_start.sh
30 lines (25 loc) · 888 Bytes
/
quick_start.sh
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
#!/bin/bash
# Variables
PROJECT_DIR="java_version/location_server"
NETWORK_NAME="host"
#NETWORK_SUBNET="101.0.0.0/24"
IMAGE_NAME="awm-v2-location-manager"
CONTAINER_NAME="awm-v2-location-manager"
#CONTAINER_IP="101.0.0.2"
# Step 1: Java Build
cd $PROJECT_DIR || { echo "Directory move to $PROJECT_DIR failed."; exit 1; }
chmod +x gradlew
./gradlew build -x test || { echo "Build failed."; exit 1; }
# Step 2: Docker Create Network
#docker network create --subnet $NETWORK_SUBNET $NETWORK_NAME
#if [ $? -ne 0 ]; then
# echo "Network creation failed. An existing network already exists."
#fi
# Step 3: Docker Image Build
docker build -t $IMAGE_NAME . || { echo "Docker image build failed."; exit 1; }
# Step 4: Docker Container Start
docker run -it --rm --name $CONTAINER_NAME --network $NETWORK_NAME $IMAGE_NAME
if [ $? -ne 0 ]; then
echo "Container execution failed."
exit 1
fi