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 29
29
- run :
30
30
name : Build lambdas
31
31
command :
32
- bin/build_lambdas .sh
32
+ deployment/build-lambdas .sh
33
33
34
34
- run :
35
35
name : Deploy infrastructure
Original file line number Diff line number Diff line change 62
62
63
63
- name : Build lambdas
64
64
run : |
65
- bin/build_lambdas .sh
65
+ deployment/build-lambdas .sh
66
66
67
67
- name : Deploy infrastructure
68
68
run : |
@@ -136,7 +136,7 @@ jobs:
136
136
137
137
- name : Build lambdas
138
138
run : |
139
- bin/build_lambdas .sh
139
+ deployment/build-lambdas .sh
140
140
141
141
- name : Deploy infrastructure
142
142
run : |
Original file line number Diff line number Diff line change 41
41
preview-cmd : |
42
42
# Add your custom deployment commands here.
43
43
# 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 48
48
49
49
- name : Deploy Infrastructure (Example)
50
50
run : |
51
- bin/build_lambdas .sh && deployment/awslocal/deploy.sh
51
+ deployment/build-lambdas .sh && deployment/awslocal/deploy.sh
52
52
53
53
- name : Export LocalStack State File
54
54
id : export_state
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ deploy:
57
57
- .github/*
58
58
- when : always
59
59
script :
60
- - ./bin/build_lambdas .sh
60
+ - ./deployment/build-lambdas .sh
61
61
- ./deployment/awslocal/deploy.sh
62
62
- mkdir -p /usr/lib/localstack
63
63
- localstack state export ls-state-pod.zip
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ install:
28
28
# # Build the Lambda functions
29
29
build-lambdas :
30
30
@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"
32
32
@echo " Lambda functions built successfully."
33
33
34
34
# # 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>
71
71
localstack start
72
72
```
73
73
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
+
74
80
To deploy the sample application, run the following command:
75
81
76
82
``` shell
77
- bin /deploy.sh
83
+ deployment/awslocal /deploy.sh
78
84
```
79
85
80
86
The 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:
25
25
- localstack start -d
26
26
pre_build :
27
27
commands :
28
- - bin/build_lambdas .sh
28
+ - deployment/build-lambdas .sh
29
29
- deployment/awslocal/deploy.sh
30
30
build :
31
31
commands :
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
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