#!/bin/bash echo -e "\E[1;34mCleanup docker build cache to reduce disk usage\E[1;0m" docker image prune -f docker container prune -f function build { K8NAMESPACE="flights-ui" echo -e "\E[1;34mBuilding $2 ($1)\E[1;0m" export CopyRetryCount=100 docker rmi -f $(docker images aeroflot.$K8NAMESPACE/$1 -a -q|uniq) >/dev/null 2>/dev/null ls -l "$2/Dockerfile" # MAP_TILE_URL must be a build-arg (not just a runtime env) because # Modern.js bakes html.tags into the HTML template at `pnpm build:standalone` # time. Setting it only on the pod won't change the served HTML. # Defaults here keep the prod-cluster behavior (same-origin) intact; # devwebzavod builds override with the flights.test.aeroflot.ru URL. : "${MAP_TILE_URL:=/map/api/tile/{z}/{x}/{y}.jpeg}" export MAP_TILE_URL docker build -t aeroflot.$K8NAMESPACE/$1:v$VERSION.$BUILD_NUMBER \ --build-arg ENVIRONMENT=${ENVIRONMENT} \ --build-arg=NPM_PROXY \ --build-arg MAP_TILE_URL=${MAP_TILE_URL} \ -f "$2/Dockerfile" $2 } build flights-ui "../Aeroflot.Flights.Front" exit 0