Skip to content

Commit f624035

Browse files
committed
debugs
1 parent 1567a59 commit f624035

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

terraform/package_lambda.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ set -e
44
echo "🚀 Packaging Lambda1..."
55

66
PROJECT_DIR="${1:-.}" # Default to current dir if not provided
7+
BUILD_DIR="${2:-build}" # Default build directory if not provided
8+
echo "Project directory: $PROJECT_DIR"
9+
echo "Build directory: $BUILD_DIR"
710

811
# show current directory
912
echo "📂 Current directory: $(pwd)
10-
Project directory: $PROJECT_DIR"
13+
1114
# list contents of the project directory
1215
echo "📂 Contents of project directory: $(ls -1 $PROJECT_DIR)"
1316
@@ -19,19 +22,19 @@ cd "$PROJECT_DIR"
1922
echo "📂 Current directory after change: $(pwd)"
2023
2124
# Clean previous build
22-
rm -rf build lambda_package.zip
23-
mkdir -p build
25+
rm -rf "$BUILD_DIR" lambda_package.zip
26+
mkdir -p "$BUILD_DIR"
2427
2528
# Export dependencies (using poetry) and install them
2629
poetry export -f requirements.txt --without-hashes -o requirements.txt
27-
pip install -r requirements.txt -t build/
30+
pip install -r requirements.txt -t "$BUILD_DIR"
2831
2932
# Copy only the needed source code and files
30-
cp -r src/* build/
31-
cp pyproject.toml poetry.lock build/
33+
cp -r src/* "$BUILD_DIR"
34+
cp pyproject.toml poetry.lock "$BUILD_DIR"
3235
3336
# Create deployment zip
34-
cd build
37+
cd "$BUILD_DIR"
3538
zip -r ../lambda_package.zip .
3639
cd ..
3740

terraform/redis_sync_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ resource "null_resource" "chmod_package_lambda" {
3434

3535
resource "null_resource" "package_lambda" {
3636
provisioner "local-exec" {
37-
command = "chmod +x ${path.module}/package_lambda.sh && ${path.module}/package_lambda.sh ${local.redis_sync_dir}"
37+
command = "chmod +x ${path.module}/package_lambda.sh && ${path.module}/package_lambda.sh ${local.redis_sync_dir} ${path.module}/build"
3838
}
3939
depends_on = [null_resource.chmod_package_lambda]
4040
triggers = {

0 commit comments

Comments
 (0)