Add ERPNext 16 production build configuration
This commit is contained in:
1 parent
ce190b09c8
commit
967299888a
3 files changed
+118
No files matched your search
@@ -0,0 +1,117 @@
|
||||
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_DIR="${ROOT_DIR}/frappe_repo"
|
||||
|
||||
REGISTRY_IMAGE="git.prothmann.com/christian/erpnexthp"
|
||||
BUILD_IMAGE="${REGISTRY_IMAGE}:build-local"
|
||||
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# --------------------------------------------------
|
||||
# 1. Define applications
|
||||
# --------------------------------------------------
|
||||
|
||||
APPS_FILE="$(mktemp)"
|
||||
trap 'rm -f "$APPS_FILE"' EXIT
|
||||
|
||||
cat > "$APPS_FILE" <<'JSON'
|
||||
[
|
||||
{
|
||||
"url": "https://github.com/frappe/erpnext",
|
||||
"branch": "version-16"
|
||||
},
|
||||
{
|
||||
"url": "https://git.prothmann.com/christian/manufacturing_overview",
|
||||
"branch": "version-15"
|
||||
},
|
||||
{
|
||||
"url": "https://git.prothmann.com/christian/label_printing",
|
||||
"branch": "version-15"
|
||||
},
|
||||
{
|
||||
"url": "https://git.prothmann.com/christian/manufacturing_utilities",
|
||||
"branch": "test"
|
||||
}
|
||||
]
|
||||
JSON
|
||||
|
||||
# --------------------------------------------------
|
||||
# 2. Build AMD64 production image
|
||||
# --------------------------------------------------
|
||||
|
||||
echo "Building ERPNext 16 for linux/amd64..."
|
||||
|
||||
docker buildx build \
|
||||
--platform linux/amd64 \
|
||||
--pull \
|
||||
--load \
|
||||
--build-arg FRAPPE_PATH=https://github.com/frappe/frappe \
|
||||
--build-arg FRAPPE_BRANCH=version-16 \
|
||||
--build-arg "CACHE_BUST=$(date -u +%s)" \
|
||||
--secret "id=apps_json,src=${APPS_FILE}" \
|
||||
--tag "${BUILD_IMAGE}" \
|
||||
--file images/layered/Containerfile \
|
||||
.
|
||||
|
||||
# --------------------------------------------------
|
||||
# 3. Read ERPNext version from built image
|
||||
# --------------------------------------------------
|
||||
|
||||
ERP_VERSION="$(
|
||||
docker run --rm \
|
||||
--platform linux/amd64 \
|
||||
--entrypoint /bin/cat \
|
||||
"${BUILD_IMAGE}" \
|
||||
/home/frappe/frappe-bench/apps/erpnext/erpnext/__init__.py \
|
||||
| awk -F '"' '/^__version__ = / {print $2; exit}'
|
||||
)"
|
||||
|
||||
if [[ ! "$ERP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "ERROR: Could not determine ERPNext version."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FINAL_IMAGE="${REGISTRY_IMAGE}:${ERP_VERSION}"
|
||||
|
||||
echo "Detected ERPNext version: ${ERP_VERSION}"
|
||||
|
||||
# --------------------------------------------------
|
||||
# 4. Tag and push to Gitea
|
||||
# --------------------------------------------------
|
||||
|
||||
docker tag "${BUILD_IMAGE}" "${FINAL_IMAGE}"
|
||||
|
||||
echo "Publishing ${FINAL_IMAGE}..."
|
||||
|
||||
docker push "${FINAL_IMAGE}"
|
||||
|
||||
# --------------------------------------------------
|
||||
# 5. Generate official Compose for hyp1
|
||||
# --------------------------------------------------
|
||||
|
||||
echo "Generating production Docker Compose..."
|
||||
|
||||
docker compose \
|
||||
--project-name erpnext-16 \
|
||||
-f compose.yaml \
|
||||
-f overrides/compose.mariadb.yaml \
|
||||
-f overrides/compose.redis.yaml \
|
||||
config --no-interpolate \
|
||||
> "${ROOT_DIR}/docker-compose.yml"
|
||||
|
||||
# Ensure the version stays configurable
|
||||
if ! grep -q 'CUSTOM_IMAGE' "${ROOT_DIR}/docker-compose.yml"; then
|
||||
echo "ERROR: Image variables were not preserved."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Build completed successfully."
|
||||
echo "Image: ${FINAL_IMAGE}"
|
||||
echo "Compose: ${ROOT_DIR}/docker-compose.yml"
|
||||
echo ""
|
||||
echo "Update ERPNEXT_VERSION=${ERP_VERSION} on hyp1."
|
||||
|
||||
Reference in new issue
Block a user