Build: Docker: Dev: Added build/clean base images by default

This commit is contained in:
Alexey Safronov 2023-08-09 12:29:39 +04:00
parent 6bb5c28a9f
commit ceead77137
2 changed files with 44 additions and 16 deletions

View File

@ -23,6 +23,14 @@ 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
@ -48,26 +56,43 @@ rm -rf $dir/publish
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"
proxy_version=v1.0.0
dotnet_version=dev
if [ "$1" = "--build_proxy" ]; then
proxy_version=v9.9.9
exists=$(docker images | egrep "onlyoffice/4testing-docspace-dotnet-runtime" | egrep "$dotnet_version" | awk 'NR>0 {print $1 ":" $2}')
exists=$(docker images | egrep "onlyoffice/4testing-docspace-proxy-runtime" | egrep "$proxy_version" | awk 'NR>0 {print $1 ":" $2}')
if [ "${exists}" = "" ]; 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 proxy .
else
echo "SKIP build proxy base image (already exists)"
fi
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 proxy .
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:v1.0.0" \
Baseimage_Nodejs_Run="onlyoffice/4testing-docspace-nodejs-runtime:v1.0.0" \
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 \

View File

@ -12,9 +12,9 @@ then
echo "Remove all backend containers"
DOCUMENT_SERVER_IMAGE_NAME=onlyoffice/documentserver-de:latest \
Baseimage_Dotnet_Run="onlyoffice/4testing-docspace-dotnet-runtime:v1.0.0" \
Baseimage_Nodejs_Run="onlyoffice/4testing-docspace-nodejs-runtime:v1.0.0" \
Baseimage_Proxy_Run="onlyoffice/4testing-docspace-proxy-runtime:v1.0.0" \
Baseimage_Dotnet_Run="onlyoffice/4testing-docspace-dotnet-runtime:dev" \
Baseimage_Nodejs_Run="onlyoffice/4testing-docspace-nodejs-runtime:dev" \
Baseimage_Proxy_Run="onlyoffice/4testing-docspace-proxy-runtime:dev" \
SERVICE_CLIENT="localhost:5001" \
BUILD_PATH="/var/www" \
SRC_PATH="${RootDir}/publish/services" \
@ -28,6 +28,9 @@ then
echo "Remove docker volumes"
docker volume prune -f -a
echo "Remove docker base images (onlyoffice/4testing-docspace)"
docker rmi -f $(docker images -a | egrep "onlyoffice/4testing-docspace" | awk 'NR>0 {print $3}')
echo "Remove unused networks."
docker network prune -f
else