mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-11-05 13:35:15 +00:00
Adding back in build scripts
auto user run build scripts
This commit is contained in:
parent
ff366fa6ba
commit
26f095cdd2
211
Build and Run for first time.bat
Normal file
211
Build and Run for first time.bat
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
REM --- Configuration ---
|
||||||
|
set REPO_URL=https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git
|
||||||
|
set CLONE_DIR=hapi-fhir-jpaserver
|
||||||
|
set SOURCE_CONFIG_DIR=hapi-fhir-setup
|
||||||
|
set CONFIG_FILE=application.yaml
|
||||||
|
|
||||||
|
REM --- Define Paths ---
|
||||||
|
set SOURCE_CONFIG_PATH=..\%SOURCE_CONFIG_DIR%\target\classes\%CONFIG_FILE%
|
||||||
|
set DEST_CONFIG_PATH=%CLONE_DIR%\target\classes\%CONFIG_FILE%
|
||||||
|
|
||||||
|
REM === CORRECTED: Prompt for Version ===
|
||||||
|
:GetModeChoice
|
||||||
|
SET "APP_MODE=" REM Clear the variable first
|
||||||
|
echo Select Installation Mode:
|
||||||
|
echo 1. Standalone (Includes local HAPI FHIR Server - Requires Git & Maven)
|
||||||
|
echo 2. Lite (Excludes local HAPI FHIR Server - No Git/Maven needed)
|
||||||
|
CHOICE /C 12 /N /M "Enter your choice (1 or 2):"
|
||||||
|
|
||||||
|
IF ERRORLEVEL 2 (
|
||||||
|
SET APP_MODE=lite
|
||||||
|
goto :ModeSet
|
||||||
|
)
|
||||||
|
IF ERRORLEVEL 1 (
|
||||||
|
SET APP_MODE=standalone
|
||||||
|
goto :ModeSet
|
||||||
|
)
|
||||||
|
REM If somehow neither was chosen (e.g., Ctrl+C), loop back
|
||||||
|
echo Invalid input. Please try again.
|
||||||
|
goto :GetModeChoice
|
||||||
|
|
||||||
|
:ModeSet
|
||||||
|
IF "%APP_MODE%"=="" (
|
||||||
|
echo Invalid choice detected after checks. Exiting.
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
echo Selected Mode: %APP_MODE%
|
||||||
|
echo.
|
||||||
|
REM === END CORRECTION ===
|
||||||
|
|
||||||
|
|
||||||
|
REM === Conditionally Execute HAPI Setup ===
|
||||||
|
IF "%APP_MODE%"=="standalone" (
|
||||||
|
echo Running Standalone setup including HAPI FHIR...
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 0: Clean up previous clone (optional) ---
|
||||||
|
echo Checking for existing directory: %CLONE_DIR%
|
||||||
|
if exist "%CLONE_DIR%" (
|
||||||
|
echo Found existing directory, removing it...
|
||||||
|
rmdir /s /q "%CLONE_DIR%"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Failed to remove existing directory: %CLONE_DIR%
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Existing directory removed.
|
||||||
|
) else (
|
||||||
|
echo Directory does not exist, proceeding with clone.
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 1: Clone the HAPI FHIR server repository ---
|
||||||
|
echo Cloning repository: %REPO_URL% into %CLONE_DIR%...
|
||||||
|
git clone "%REPO_URL%" "%CLONE_DIR%"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Failed to clone repository. Check Git installation and network connection.
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Repository cloned successfully.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 2: Navigate into the cloned directory ---
|
||||||
|
echo Changing directory to %CLONE_DIR%...
|
||||||
|
cd "%CLONE_DIR%"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Failed to change directory to %CLONE_DIR%.
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Current directory: %CD%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 3: Build the HAPI server using Maven ---
|
||||||
|
echo ===> "Starting Maven build (Step 3)...""
|
||||||
|
cmd /c "mvn clean package -DskipTests=true -Pboot"
|
||||||
|
echo ===> Maven command finished. Checking error level...
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Maven build failed or cmd /c failed
|
||||||
|
cd ..
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Maven build completed successfully. ErrorLevel: %errorlevel%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 4: Copy the configuration file ---
|
||||||
|
echo ===> "Starting file copy (Step 4)..."
|
||||||
|
echo Copying configuration file...
|
||||||
|
echo Source: %SOURCE_CONFIG_PATH%
|
||||||
|
echo Destination: target\classes\%CONFIG_FILE%
|
||||||
|
xcopy "%SOURCE_CONFIG_PATH%" "target\classes\" /Y /I
|
||||||
|
echo ===> xcopy command finished. Checking error level...
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo WARNING: Failed to copy configuration file. Check if the source file exists.
|
||||||
|
echo The script will continue, but the server might use default configuration.
|
||||||
|
) else (
|
||||||
|
echo Configuration file copied successfully. ErrorLevel: %errorlevel%
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 5: Navigate back to the parent directory ---
|
||||||
|
echo ===> "Changing directory back (Step 5)..."
|
||||||
|
cd ..
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Failed to change back to the parent directory. ErrorLevel: %errorlevel%
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Current directory: %CD%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
) ELSE (
|
||||||
|
echo Running Lite setup, skipping HAPI FHIR build...
|
||||||
|
REM Ensure the hapi-fhir-jpaserver directory doesn't exist or is empty if Lite mode is chosen after a standalone attempt
|
||||||
|
if exist "%CLONE_DIR%" (
|
||||||
|
echo Found existing HAPI directory in Lite mode. Removing it to avoid build issues...
|
||||||
|
rmdir /s /q "%CLONE_DIR%"
|
||||||
|
)
|
||||||
|
REM Create empty target directories expected by Dockerfile COPY, even if not used
|
||||||
|
mkdir "%CLONE_DIR%\target\classes" 2> nul
|
||||||
|
mkdir "%CLONE_DIR%\custom" 2> nul
|
||||||
|
REM Create a placeholder empty WAR file to satisfy Dockerfile COPY
|
||||||
|
echo. > "%CLONE_DIR%\target\ROOT.war"
|
||||||
|
echo. > "%CLONE_DIR%\target\classes\application.yaml"
|
||||||
|
echo Placeholder files created for Lite mode build.
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM === Modify docker-compose.yml to set APP_MODE ===
|
||||||
|
echo Updating docker-compose.yml with APP_MODE=%APP_MODE%...
|
||||||
|
(
|
||||||
|
echo version: '3.8'
|
||||||
|
echo services:
|
||||||
|
echo fhirflare:
|
||||||
|
echo build:
|
||||||
|
echo context: .
|
||||||
|
echo dockerfile: Dockerfile
|
||||||
|
echo ports:
|
||||||
|
echo - "5000:5000"
|
||||||
|
echo - "8080:8080" # Keep port exposed, even if Tomcat isn't running useful stuff in Lite
|
||||||
|
echo volumes:
|
||||||
|
echo - ./instance:/app/instance
|
||||||
|
echo - ./static/uploads:/app/static/uploads
|
||||||
|
echo - ./instance/hapi-h2-data/:/app/h2-data # Keep volume mounts consistent
|
||||||
|
echo - ./logs:/app/logs
|
||||||
|
echo environment:
|
||||||
|
echo - FLASK_APP=app.py
|
||||||
|
echo - FLASK_ENV=development
|
||||||
|
echo - NODE_PATH=/usr/lib/node_modules
|
||||||
|
echo - APP_MODE=%APP_MODE%
|
||||||
|
echo - APP_BASE_URL=http://localhost:5000
|
||||||
|
echo - HAPI_FHIR_URL=http://localhost:8080/fhir
|
||||||
|
echo command: supervisord -c /etc/supervisord.conf
|
||||||
|
) > docker-compose.yml.tmp
|
||||||
|
|
||||||
|
REM Check if docker-compose.yml.tmp was created successfully
|
||||||
|
if not exist docker-compose.yml.tmp (
|
||||||
|
echo ERROR: Failed to create temporary docker-compose file.
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Replace the original docker-compose.yml
|
||||||
|
del docker-compose.yml /Q > nul 2>&1
|
||||||
|
ren docker-compose.yml.tmp docker-compose.yml
|
||||||
|
echo docker-compose.yml updated successfully.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 6: Build Docker images ---
|
||||||
|
echo ===> Starting Docker build (Step 6)...
|
||||||
|
docker-compose build --no-cache
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Docker Compose build failed. Check Docker installation and docker-compose.yml file. ErrorLevel: %errorlevel%
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Docker images built successfully. ErrorLevel: %errorlevel%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM --- Step 7: Start Docker containers ---
|
||||||
|
echo ===> Starting Docker containers (Step 7)...
|
||||||
|
docker-compose up -d
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Docker Compose up failed. Check Docker installation and container configurations. ErrorLevel: %errorlevel%
|
||||||
|
goto :error
|
||||||
|
)
|
||||||
|
echo Docker containers started successfully. ErrorLevel: %errorlevel%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
echo ====================================
|
||||||
|
echo Script finished successfully! (Mode: %APP_MODE%)
|
||||||
|
echo ====================================
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo ------------------------------------
|
||||||
|
echo An error occurred. Script aborted.
|
||||||
|
echo ------------------------------------
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:eof
|
||||||
|
echo Script execution finished.
|
||||||
|
pause
|
||||||
233
setup_linux.sh
Normal file
233
setup_linux.sh
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# --- Configuration ---
|
||||||
|
REPO_URL="https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git"
|
||||||
|
CLONE_DIR="hapi-fhir-jpaserver"
|
||||||
|
SOURCE_CONFIG_DIR="hapi-fhir-Setup" # Assuming this is relative to the script's parent
|
||||||
|
CONFIG_FILE="application.yaml"
|
||||||
|
|
||||||
|
# --- Define Paths ---
|
||||||
|
# Note: Adjust SOURCE_CONFIG_PATH if SOURCE_CONFIG_DIR is not a sibling directory
|
||||||
|
# This assumes the script is run from a directory, and hapi-fhir-setup is at the same level
|
||||||
|
SOURCE_CONFIG_PATH="../${SOURCE_CONFIG_DIR}/target/classes/${CONFIG_FILE}"
|
||||||
|
DEST_CONFIG_PATH="${CLONE_DIR}/target/classes/${CONFIG_FILE}"
|
||||||
|
|
||||||
|
APP_MODE=""
|
||||||
|
|
||||||
|
# --- Error Handling Function ---
|
||||||
|
handle_error() {
|
||||||
|
echo "------------------------------------"
|
||||||
|
echo "An error occurred: $1"
|
||||||
|
echo "Script aborted."
|
||||||
|
echo "------------------------------------"
|
||||||
|
# Removed 'read -p "Press Enter to exit..."' as it's not typical for non-interactive CI/CD
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# === Prompt for Installation Mode ===
|
||||||
|
get_mode_choice() {
|
||||||
|
echo "Select Installation Mode:"
|
||||||
|
echo "1. Standalone (Includes local HAPI FHIR Server - Requires Git & Maven)"
|
||||||
|
echo "2. Lite (Excludes local HAPI FHIR Server - No Git/Maven needed)"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -r -p "Enter your choice (1 or 2): " choice
|
||||||
|
case "$choice" in
|
||||||
|
1)
|
||||||
|
APP_MODE="standalone"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
APP_MODE="lite"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid input. Please try again."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "Selected Mode: $APP_MODE"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call the function to get mode choice
|
||||||
|
get_mode_choice
|
||||||
|
|
||||||
|
# === Conditionally Execute HAPI Setup ===
|
||||||
|
if [ "$APP_MODE" = "standalone" ]; then
|
||||||
|
echo "Running Standalone setup including HAPI FHIR..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 0: Clean up previous clone (optional) ---
|
||||||
|
echo "Checking for existing directory: $CLONE_DIR"
|
||||||
|
if [ -d "$CLONE_DIR" ]; then
|
||||||
|
echo "Found existing directory, removing it..."
|
||||||
|
rm -rf "$CLONE_DIR"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
handle_error "Failed to remove existing directory: $CLONE_DIR"
|
||||||
|
fi
|
||||||
|
echo "Existing directory removed."
|
||||||
|
else
|
||||||
|
echo "Directory does not exist, proceeding with clone."
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 1: Clone the HAPI FHIR server repository ---
|
||||||
|
echo "Cloning repository: $REPO_URL into $CLONE_DIR..."
|
||||||
|
git clone "$REPO_URL" "$CLONE_DIR"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
handle_error "Failed to clone repository. Check Git installation and network connection."
|
||||||
|
fi
|
||||||
|
echo "Repository cloned successfully."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 2: Navigate into the cloned directory ---
|
||||||
|
echo "Changing directory to $CLONE_DIR..."
|
||||||
|
cd "$CLONE_DIR" || handle_error "Failed to change directory to $CLONE_DIR."
|
||||||
|
echo "Current directory: $(pwd)"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 3: Build the HAPI server using Maven ---
|
||||||
|
echo "===> Starting Maven build (Step 3)..."
|
||||||
|
mvn clean package -DskipTests=true -Pboot
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Maven build failed."
|
||||||
|
cd ..
|
||||||
|
handle_error "Maven build process resulted in an error."
|
||||||
|
fi
|
||||||
|
echo "Maven build completed successfully."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 4: Copy the configuration file ---
|
||||||
|
echo "===> Starting file copy (Step 4)..."
|
||||||
|
echo "Copying configuration file..."
|
||||||
|
# Corrected SOURCE_CONFIG_PATH to be relative to the new current directory ($CLONE_DIR)
|
||||||
|
# This assumes the original script's SOURCE_CONFIG_PATH was relative to its execution location
|
||||||
|
# If SOURCE_CONFIG_DIR is ../hapi-fhir-setup relative to script's original location:
|
||||||
|
# Then from within CLONE_DIR, it becomes ../../hapi-fhir-setup
|
||||||
|
# We defined SOURCE_CONFIG_PATH earlier relative to the script start.
|
||||||
|
# So, when inside CLONE_DIR, the path from original script location should be used.
|
||||||
|
# The original script had: set SOURCE_CONFIG_PATH=..\%SOURCE_CONFIG_DIR%\target\classes\%CONFIG_FILE%
|
||||||
|
# And then: xcopy "%SOURCE_CONFIG_PATH%" "target\classes\"
|
||||||
|
# This implies SOURCE_CONFIG_PATH is relative to the original script's location, not the $CLONE_DIR
|
||||||
|
# Therefore, we need to construct the correct relative path from *within* $CLONE_DIR back to the source.
|
||||||
|
# Assuming the script is in dir X, and SOURCE_CONFIG_DIR is ../hapi-fhir-setup from X.
|
||||||
|
# So, hapi-fhir-setup is a sibling of X's parent.
|
||||||
|
# If CLONE_DIR is also in X, then from within CLONE_DIR, the path is ../ + original SOURCE_CONFIG_PATH
|
||||||
|
# For simplicity and robustness, let's use an absolute path or a more clearly defined relative path from the start.
|
||||||
|
# The original `SOURCE_CONFIG_PATH=..\%SOURCE_CONFIG_DIR%\target\classes\%CONFIG_FILE%` implies
|
||||||
|
# that `hapi-fhir-setup` is a sibling of the directory where the script *is being run from*.
|
||||||
|
|
||||||
|
# Let's assume the script is run from the root of FHIRFLARE-IG-Toolkit.
|
||||||
|
# And hapi-fhir-setup is also in the root, next to this script.
|
||||||
|
# Then SOURCE_CONFIG_PATH would be ./hapi-fhir-setup/target/classes/application.yaml
|
||||||
|
# And from within ./hapi-fhir-jpaserver/, the path would be ../hapi-fhir-setup/target/classes/application.yaml
|
||||||
|
|
||||||
|
# The original batch file sets SOURCE_CONFIG_PATH as "..\%SOURCE_CONFIG_DIR%\target\classes\%CONFIG_FILE%"
|
||||||
|
# And COPIES it to "target\classes\" *while inside CLONE_DIR*.
|
||||||
|
# This means the source path is relative to where the *cd %CLONE_DIR%* happened from.
|
||||||
|
# Let's make it relative to the script's initial execution directory.
|
||||||
|
INITIAL_SCRIPT_DIR=$(pwd)
|
||||||
|
ABSOLUTE_SOURCE_CONFIG_PATH="${INITIAL_SCRIPT_DIR}/../${SOURCE_CONFIG_DIR}/target/classes/${CONFIG_FILE}" # This matches the ..\ logic
|
||||||
|
|
||||||
|
echo "Source: $ABSOLUTE_SOURCE_CONFIG_PATH"
|
||||||
|
echo "Destination: target/classes/$CONFIG_FILE"
|
||||||
|
|
||||||
|
if [ ! -f "$ABSOLUTE_SOURCE_CONFIG_PATH" ]; then
|
||||||
|
echo "WARNING: Source configuration file not found at $ABSOLUTE_SOURCE_CONFIG_PATH."
|
||||||
|
echo "The script will continue, but the server might use default configuration."
|
||||||
|
else
|
||||||
|
cp "$ABSOLUTE_SOURCE_CONFIG_PATH" "target/classes/"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "WARNING: Failed to copy configuration file. Check if the source file exists and permissions."
|
||||||
|
echo "The script will continue, but the server might use default configuration."
|
||||||
|
else
|
||||||
|
echo "Configuration file copied successfully."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 5: Navigate back to the parent directory ---
|
||||||
|
echo "===> Changing directory back (Step 5)..."
|
||||||
|
cd .. || handle_error "Failed to change back to the parent directory."
|
||||||
|
echo "Current directory: $(pwd)"
|
||||||
|
echo
|
||||||
|
|
||||||
|
else # APP_MODE is "lite"
|
||||||
|
echo "Running Lite setup, skipping HAPI FHIR build..."
|
||||||
|
# Ensure the hapi-fhir-jpaserver directory doesn't exist or is empty if Lite mode is chosen
|
||||||
|
if [ -d "$CLONE_DIR" ]; then
|
||||||
|
echo "Found existing HAPI directory ($CLONE_DIR) in Lite mode. Removing it..."
|
||||||
|
rm -rf "$CLONE_DIR"
|
||||||
|
fi
|
||||||
|
# Create empty target directories expected by Dockerfile COPY, even if not used
|
||||||
|
mkdir -p "${CLONE_DIR}/target/classes"
|
||||||
|
mkdir -p "${CLONE_DIR}/custom" # This was in the original batch, ensure it's here
|
||||||
|
# Create a placeholder empty WAR file and application.yaml to satisfy Dockerfile COPY
|
||||||
|
touch "${CLONE_DIR}/target/ROOT.war"
|
||||||
|
touch "${CLONE_DIR}/target/classes/application.yaml"
|
||||||
|
echo "Placeholder files and directories created for Lite mode build in $CLONE_DIR."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# === Modify docker-compose.yml to set APP_MODE ===
|
||||||
|
echo "Updating docker-compose.yml with APP_MODE=$APP_MODE..."
|
||||||
|
DOCKER_COMPOSE_TMP="docker-compose.yml.tmp"
|
||||||
|
DOCKER_COMPOSE_ORIG="docker-compose.yml"
|
||||||
|
|
||||||
|
cat << EOF > "$DOCKER_COMPOSE_TMP"
|
||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
fhirflare:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
- "8080:8080" # Keep port exposed, even if Tomcat isn't running useful stuff in Lite
|
||||||
|
volumes:
|
||||||
|
- ./instance:/app/instance
|
||||||
|
- ./static/uploads:/app/static/uploads
|
||||||
|
- ./instance/hapi-h2-data/:/app/h2-data # Keep volume mounts consistent
|
||||||
|
- ./logs:/app/logs
|
||||||
|
environment:
|
||||||
|
- FLASK_APP=app.py
|
||||||
|
- FLASK_ENV=development
|
||||||
|
- NODE_PATH=/usr/lib/node_modules
|
||||||
|
- APP_MODE=${APP_MODE}
|
||||||
|
- APP_BASE_URL=http://localhost:5000
|
||||||
|
- HAPI_FHIR_URL=http://localhost:8080/fhir
|
||||||
|
command: supervisord -c /etc/supervisord.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ ! -f "$DOCKER_COMPOSE_TMP" ]; then
|
||||||
|
handle_error "Failed to create temporary docker-compose file ($DOCKER_COMPOSE_TMP)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace the original docker-compose.yml
|
||||||
|
mv "$DOCKER_COMPOSE_TMP" "$DOCKER_COMPOSE_ORIG"
|
||||||
|
echo "docker-compose.yml updated successfully."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 6: Build Docker images ---
|
||||||
|
echo "===> Starting Docker build (Step 6)..."
|
||||||
|
docker-compose build --no-cache
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
handle_error "Docker Compose build failed. Check Docker installation and docker-compose.yml file."
|
||||||
|
fi
|
||||||
|
echo "Docker images built successfully."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# --- Step 7: Start Docker containers ---
|
||||||
|
echo "===> Starting Docker containers (Step 7)..."
|
||||||
|
docker-compose up -d
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
handle_error "Docker Compose up failed. Check Docker installation and container configurations."
|
||||||
|
fi
|
||||||
|
echo "Docker containers started successfully."
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "===================================="
|
||||||
|
echo "Script finished successfully! (Mode: $APP_MODE)"
|
||||||
|
echo "===================================="
|
||||||
|
exit 0
|
||||||
Loading…
x
Reference in New Issue
Block a user