Skip to content

Commit

Permalink
add script to build lambda layers
Browse files Browse the repository at this point in the history
  • Loading branch information
paliwalvimal committed Apr 2, 2024
1 parent 175327f commit 151f57c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions terraform/build-lambda-layers
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -eu

# Script to build/upgrade lambda layers zip

CURRENT_DIR="$(pwd)"
TEMP_DIR="$(mktemp -d)"

mkdir "${TEMP_DIR}/python"

echo "Building requests layer..."
cd "${TEMP_DIR}/python"
python3 -m pip install --platform manylinux2014_x86_64 --implementation cp --only-binary=:all: --target . requests
cd ..
zip -r "${CURRENT_DIR}/requests.zip" python
rm -rf python/*

echo "Building pytz layer..."
cd "${TEMP_DIR}/python"
python3 -m pip install --platform manylinux2014_x86_64 --implementation cp --only-binary=:all: --target . pytz
cd ..
zip -r "${CURRENT_DIR}/pytz.zip" python
rm -rf python/*

echo "Building cryptography layer..."
cd "${TEMP_DIR}/python"
python3 -m pip install --platform manylinux2014_x86_64 --implementation cp --only-binary=:all: --target . cryptography
cd ..
zip -r "${CURRENT_DIR}/cryptography.zip" python
rm -rf python/*

cd "${CURRENT_DIR}"
rm -rf "${TEMP_DIR}"

0 comments on commit 151f57c

Please sign in to comment.