front-integrations/terraform/build_packages.sh

30 lines
916 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Package Lambda zips for HCP plan/apply. Runs on the Terraform worker.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
BUILD="${ROOT}/build"
SRC="$(cd "${ROOT}/../src" && pwd)"
rm -rf "${BUILD}"
mkdir -p "${BUILD}/sla_monitor" "${BUILD}/user_sync"
cp "${SRC}/sla_monitor/app.py" "${BUILD}/sla_monitor/app.py"
cp "${SRC}/user_sync/app.py" "${BUILD}/user_sync/app.py"
python3 -m pip install \
--quiet \
--disable-pip-version-check \
-r "${SRC}/user_sync/requirements.txt" \
-t "${BUILD}/user_sync/" \
--platform manylinux2014_aarch64 \
--implementation cp \
--python-version 3.12 \
--only-binary=:all: \
--upgrade
# Runtime provides boto3; drop the copy to keep the zip smaller.
rm -rf "${BUILD}/user_sync/boto3" "${BUILD}/user_sync/botocore" \
"${BUILD}/user_sync/s3transfer" "${BUILD}/user_sync/jmespath" \
"${BUILD}/user_sync/"*.dist-info 2>/dev/null || true