sightbox/erpnext-image/build.sh

41 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the branding-patched ERPNext image (see Dockerfile) and tags it to
# match whatever CUSTOM_IMAGE/CUSTOM_TAG this deployment's .env expects.
#
# Usage (from the sightbox/ project root or from here — either works):
# ./erpnext-image/build.sh
#
# Re-run this any time ERPNEXT_VERSION in .env changes — the Dockerfile's
# own grep checks fail the build loudly if erpnext/hooks.py no longer
# matches what this patch expects (e.g. after a version bump reworded it),
# rather than silently shipping an unpatched image.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_ENV="${SCRIPT_DIR}/../.env"
if [ -f "$ROOT_ENV" ]; then
set -a
# shellcheck disable=SC1090
source "$ROOT_ENV"
set +a
fi
ERPNEXT_VERSION="${ERPNEXT_VERSION:?Set ERPNEXT_VERSION in .env first (see .env.example)}"
CUSTOM_IMAGE="${CUSTOM_IMAGE:-sightbox-erpnext}"
CUSTOM_TAG="${CUSTOM_TAG:-${ERPNEXT_VERSION}-branded}"
echo "Building ${CUSTOM_IMAGE}:${CUSTOM_TAG} from frappe/erpnext:${ERPNEXT_VERSION}"
docker build \
--build-arg "ERPNEXT_VERSION=${ERPNEXT_VERSION}" \
-t "${CUSTOM_IMAGE}:${CUSTOM_TAG}" \
"${SCRIPT_DIR}"
echo
echo "Built ${CUSTOM_IMAGE}:${CUSTOM_TAG}."
echo "Set in .env (see .env.example):"
echo " CUSTOM_IMAGE=${CUSTOM_IMAGE}"
echo " CUSTOM_TAG=${CUSTOM_TAG}"
echo "Then: docker compose up -d --force-recreate configurator backend frontend websocket queue-short queue-long scheduler"