Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- run:
name: Build lambdas
command:
bin/build_lambdas.sh
deployment/build-lambdas.sh

- run:
name: Deploy infrastructure
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: Build lambdas
run: |
bin/build_lambdas.sh
deployment/build-lambdas.sh

- name: Deploy infrastructure
run: |
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:

- name: Build lambdas
run: |
bin/build_lambdas.sh
deployment/build-lambdas.sh

- name: Deploy infrastructure
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
preview-cmd: |
# Add your custom deployment commands here.
# Below is an example for the Image resizer application.
bin/build_lambdas.sh && deployment/awslocal/deploy.sh
deployment/build-lambdas.sh && deployment/awslocal/deploy.sh
2 changes: 1 addition & 1 deletion .github/workflows/test_cloudpods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Deploy Infrastructure (Example)
run: |
bin/build_lambdas.sh && deployment/awslocal/deploy.sh
deployment/build-lambdas.sh && deployment/awslocal/deploy.sh

- name: Export LocalStack State File
id: export_state
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ deploy:
- .github/*
- when: always
script:
- ./bin/build_lambdas.sh
- ./deployment/build-lambdas.sh
- ./deployment/awslocal/deploy.sh
- mkdir -p /usr/lib/localstack
- localstack state export ls-state-pod.zip
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install:
## Build the Lambda functions
build-lambdas:
@echo "Building the Lambda functions..."
bash -c "source venv/bin/activate && bin/build_lambdas.sh"
bash -c "source venv/bin/activate && deployment/build-lambdas.sh"
@echo "Lambda functions built successfully."

## Deploy the application locally using `awslocal`, a wrapper for the AWS CLI
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ localstack auth set-token <your-auth-token>
localstack start
```

Before deploying the sample application, you need to build the Lambda functions. Run the following command:

```shell
deployment/build-lambdas.sh
```

To deploy the sample application, run the following command:

```shell
bin/deploy.sh
deployment/awslocal/deploy.sh
```

The output will show the Lambda function URLs that you can use in the web application:
Expand Down
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ phases:
- localstack start -d
pre_build:
commands:
- bin/build_lambdas.sh
- deployment/build-lambdas.sh
- deployment/awslocal/deploy.sh
build:
commands:
Expand Down
39 changes: 26 additions & 13 deletions deployment/build-lambdas.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#!/bin/bash

BASE_DIR="lambdas"
LAMBDA_DIRS=("presign" "list" "resize")

for dir in "${LAMBDA_DIRS[@]}"; do
LAMBDA_PATH="$BASE_DIR/$dir"
echo "Zipping Lambda function in $LAMBDA_PATH..."
if [ -d "$LAMBDA_PATH" ]; then
zip -r "$LAMBDA_PATH/lambda.zip" "$LAMBDA_PATH"/*
else
echo "Directory $LAMBDA_PATH not found!"
exit 1
fi
done
(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py)

(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py)

os=$(uname -s)
if [ "$os" == "Darwin" ]; then
(
cd lambdas/resize
rm -rf libs lambda.zip
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"

cd libs && zip -r ../lambda.zip . && cd ..
zip lambda.zip handler.py
rm -rf libs
)
else
(
cd lambdas/resize
rm -rf package lambda.zip
mkdir package
pip3 install -r requirements.txt --platform manylinux2014_x86_64 --only-binary=:all: -t package
zip lambda.zip handler.py
cd package
zip -r ../lambda.zip *;
)
fi
Loading