File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44echo " 🚀 Packaging Lambda1..."
55
66PROJECT_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
912echo " 📂 Current directory: $( pwd)
10- Project directory: $PROJECT_DIR "
13+
1114# list contents of the project directory
1215echo " 📂 Contents of project directory: $( ls -1 $PROJECT_DIR ) "
1316
@@ -19,19 +22,19 @@ cd "$PROJECT_DIR"
1922echo " 📂 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
2629poetry 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 "
3538zip -r ../lambda_package.zip .
3639cd ..
3740
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ resource "null_resource" "chmod_package_lambda" {
3434
3535resource "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 = {
You can’t perform that action at this time.
0 commit comments