112 lines
3.7 KiB
Bash
Executable File
112 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
rd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
echo "Run script directory:" $dir
|
|
|
|
dir=$(builtin cd $rd/../; pwd)
|
|
dockerDir="$dir/build/install/docker"
|
|
|
|
echo "Root directory:" $dir
|
|
echo "Docker files root directory:" $dockerDir
|
|
|
|
local_ip=$(ipconfig getifaddr en0)
|
|
|
|
echo "LOCAL IP: $local_ip"
|
|
|
|
doceditor=${local_ip}:5013
|
|
login=${local_ip}:5011
|
|
client=${local_ip}:5001
|
|
portal_url="http://$local_ip:8092"
|
|
|
|
echo "SERVICE_DOCEDITOR: $doceditor"
|
|
echo "SERVICE_LOGIN: $login"
|
|
echo "SERVICE_CLIENT: $client"
|
|
echo "APP_URL_PORTAL: $portal_url"
|
|
|
|
force=false
|
|
|
|
if [ "$1" = "--force" ]; then
|
|
force=true
|
|
fi
|
|
|
|
echo "FORCE BUILD BASE IMAGES: $force"
|
|
|
|
# Stop all backend services"
|
|
$dir/build/start/stop.backend.docker.sh
|
|
|
|
echo "Run MySQL"
|
|
|
|
arch_name="$(uname -m)"
|
|
|
|
existsnetwork=$(docker network ls | awk '{print $2;}' | { grep -x onlyoffice || true; });
|
|
|
|
if [[ -z ${existsnetwork} ]]; then
|
|
docker network create --driver bridge onlyoffice
|
|
fi
|
|
|
|
if [ "${arch_name}" = "x86_64" ]; then
|
|
echo "CPU Type: x86_64 -> run db.yml"
|
|
docker compose -f $dockerDir/db.yml up -d
|
|
elif [ "${arch_name}" = "arm64" ]; then
|
|
echo "CPU Type: arm64 -> run db.yml with arm64v8 image"
|
|
MYSQL_IMAGE=arm64v8/mysql:8.0.32-oracle \
|
|
docker compose -f $dockerDir/db.yml up -d
|
|
else
|
|
echo "Error: Unknown CPU Type: ${arch_name}."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Clear publish folder"
|
|
rm -rf $dir/publish/services
|
|
|
|
echo "Build backend services (to "publish/" folder)"
|
|
bash $dir/build/install/common/build-services.sh -pb backend-publish -pc Debug -de "$dockerDir/docker-entrypoint.py"
|
|
|
|
dotnet_version=dev
|
|
|
|
exists=$(docker images | egrep "onlyoffice/4testing-docspace-dotnet-runtime" | egrep "$dotnet_version" | awk 'NR>0 {print $1 ":" $2}')
|
|
|
|
if [ "${exists}" = "" ] || [ "$force" = true ]; then
|
|
echo "Build dotnet base image from source (apply new dotnet config)"
|
|
docker build -t onlyoffice/4testing-docspace-dotnet-runtime:$dotnet_version -f ./build/install/docker/Dockerfile.runtime --target dotnetrun .
|
|
else
|
|
echo "SKIP build dotnet base image (already exists)"
|
|
fi
|
|
|
|
node_version=dev
|
|
|
|
exists=$(docker images | egrep "onlyoffice/4testing-docspace-nodejs-runtime" | egrep "$node_version" | awk 'NR>0 {print $1 ":" $2}')
|
|
|
|
if [ "${exists}" = "" ] || [ "$force" = true ]; then
|
|
echo "Build nodejs base image from source"
|
|
docker build -t onlyoffice/4testing-docspace-nodejs-runtime:$node_version -f ./build/install/docker/Dockerfile.runtime --target noderun .
|
|
else
|
|
echo "SKIP build nodejs base image (already exists)"
|
|
fi
|
|
|
|
proxy_version=dev
|
|
|
|
exists=$(docker images | egrep "onlyoffice/4testing-docspace-proxy-runtime" | egrep "$proxy_version" | awk 'NR>0 {print $1 ":" $2}')
|
|
|
|
if [ "${exists}" = "" ] || [ "$force" = true ]; then
|
|
echo "Build proxy base image from source (apply new nginx config)"
|
|
docker build -t onlyoffice/4testing-docspace-proxy-runtime:$proxy_version -f ./build/install/docker/Dockerfile.runtime --target router .
|
|
else
|
|
echo "SKIP build proxy base image (already exists)"
|
|
fi
|
|
|
|
echo "Run migration and services"
|
|
ENV_EXTENSION="dev" \
|
|
Baseimage_Dotnet_Run="onlyoffice/4testing-docspace-dotnet-runtime:$dotnet_version" \
|
|
Baseimage_Nodejs_Run="onlyoffice/4testing-docspace-nodejs-runtime:$node_version" \
|
|
Baseimage_Proxy_Run="onlyoffice/4testing-docspace-proxy-runtime:$proxy_version" \
|
|
DOCUMENT_SERVER_IMAGE_NAME=onlyoffice/documentserver-de:latest \
|
|
SERVICE_DOCEDITOR=$doceditor \
|
|
SERVICE_LOGIN=$login \
|
|
SERVICE_CLIENT=$client \
|
|
ROOT_DIR=$dir \
|
|
BUILD_PATH="/var/www" \
|
|
SRC_PATH="$dir/publish/services" \
|
|
DATA_DIR="$dir/data" \
|
|
APP_URL_PORTAL=$portal_url \
|
|
docker-compose -f $dockerDir/docspace.profiles.yml -f $dockerDir/docspace.overcome.yml --profile migration-runner --profile backend-local up -d |