File tree Expand file tree Collapse file tree 9 files changed +41
-22
lines changed Expand file tree Collapse file tree 9 files changed +41
-22
lines changed Original file line number Diff line number Diff line change 2929 - run :
3030 name : Build lambdas
3131 command :
32- bin/build_lambdas .sh
32+ deployment/build-lambdas .sh
3333
3434 - run :
3535 name : Deploy infrastructure
Original file line number Diff line number Diff line change 6262
6363 - name : Build lambdas
6464 run : |
65- bin/build_lambdas .sh
65+ deployment/build-lambdas .sh
6666
6767 - name : Deploy infrastructure
6868 run : |
@@ -136,7 +136,7 @@ jobs:
136136
137137 - name : Build lambdas
138138 run : |
139- bin/build_lambdas .sh
139+ deployment/build-lambdas .sh
140140
141141 - name : Deploy infrastructure
142142 run : |
Original file line number Diff line number Diff line change 4141 preview-cmd : |
4242 # Add your custom deployment commands here.
4343 # Below is an example for the Image resizer application.
44- bin/build_lambdas .sh && deployment/awslocal/deploy.sh
44+ deployment/build-lambdas .sh && deployment/awslocal/deploy.sh
Original file line number Diff line number Diff line change 4848
4949 - name : Deploy Infrastructure (Example)
5050 run : |
51- bin/build_lambdas .sh && deployment/awslocal/deploy.sh
51+ deployment/build-lambdas .sh && deployment/awslocal/deploy.sh
5252
5353 - name : Export LocalStack State File
5454 id : export_state
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ deploy:
5757 - .github/*
5858 - when : always
5959 script :
60- - ./bin/build_lambdas .sh
60+ - ./deployment/build-lambdas .sh
6161 - ./deployment/awslocal/deploy.sh
6262 - mkdir -p /usr/lib/localstack
6363 - localstack state export ls-state-pod.zip
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ install:
2828# # Build the Lambda functions
2929build-lambdas :
3030 @echo " Building the Lambda functions..."
31- bash -c " source venv/bin/activate && bin/build_lambdas .sh"
31+ bash -c " source venv/bin/activate && deployment/build-lambdas .sh"
3232 @echo " Lambda functions built successfully."
3333
3434# # Deploy the application locally using `awslocal`, a wrapper for the AWS CLI
Original file line number Diff line number Diff line change @@ -71,10 +71,16 @@ localstack auth set-token <your-auth-token>
7171localstack start
7272```
7373
74+ Before deploying the sample application, you need to build the Lambda functions. Run the following command:
75+
76+ ``` shell
77+ deployment/build-lambdas.sh
78+ ```
79+
7480To deploy the sample application, run the following command:
7581
7682``` shell
77- bin /deploy.sh
83+ deployment/awslocal /deploy.sh
7884```
7985
8086The output will show the Lambda function URLs that you can use in the web application:
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ phases:
2525 - localstack start -d
2626 pre_build :
2727 commands :
28- - bin/build_lambdas .sh
28+ - deployment/build-lambdas .sh
2929 - deployment/awslocal/deploy.sh
3030 build :
3131 commands :
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- BASE_DIR=" lambdas"
4- LAMBDA_DIRS=(" presign" " list" " resize" )
5-
6- for dir in " ${LAMBDA_DIRS[@]} " ; do
7- LAMBDA_PATH=" $BASE_DIR /$dir "
8- echo " Zipping Lambda function in $LAMBDA_PATH ..."
9- if [ -d " $LAMBDA_PATH " ]; then
10- zip -r " $LAMBDA_PATH /lambda.zip" " $LAMBDA_PATH " /*
11- else
12- echo " Directory $LAMBDA_PATH not found!"
13- exit 1
14- fi
15- done
3+ (cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py)
4+
5+ (cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py)
6+
7+ os=$( uname -s)
8+ if [ " $os " == " Darwin" ]; then
9+ (
10+ cd lambdas/resize
11+ rm -rf libs lambda.zip
12+ docker run --platform linux/x86_64 --rm -v " $PWD " :/var/task " public.ecr.aws/sam/build-python3.11" /bin/sh -c " pip3 install -r requirements.txt -t libs; exit"
13+
14+ cd libs && zip -r ../lambda.zip . && cd ..
15+ zip lambda.zip handler.py
16+ rm -rf libs
17+ )
18+ else
19+ (
20+ cd lambdas/resize
21+ rm -rf package lambda.zip
22+ mkdir package
23+ pip3 install -r requirements.txt --platform manylinux2014_x86_64 --only-binary=:all: -t package
24+ zip lambda.zip handler.py
25+ cd package
26+ zip -r ../lambda.zip * ;
27+ )
28+ fi
You can’t perform that action at this time.
0 commit comments