Created
June 10, 2022 08:55
-
-
Save daknhh/d27fd1a85b6b5a5d5c39fbc9e62e6446 to your computer and use it in GitHub Desktop.
Lambda Package Builder for graviton using taskfile.dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
#output: prefixed | |
env: | |
LambdaS3Bucket: ambda-code-eu-central-1 | |
Version: 0.0.1 | |
LambdaSourceCodeDirectory: config-rules | |
vars: | |
REGION: echo AWS_REGION | |
tasks: | |
uploadlambdacode: | |
desc: Upload Lambda to s3 | |
cmds: | |
- echo $'\n ⌛️ Uploading Python Lambda {{.LambdaSourceCodeDirectory}} with dependencies' | |
- echo $'\n📁 Creating Temp Directory' | |
- mkdir temp | |
- cp -R {{.LambdaSourceCodeDirectory}}/ temp/ | |
- echo $'\n👩🏼🔧 Installing Python Dependencies for graviton to temp directory' | |
- pip3 install -r temp/requirements.txt --platform manylinux2014_aarch64 --no-deps --target temp | |
- echo $'\n🤐 Zip temp directory for lambda and upload to s3 Lambda Bucket' | |
- cd temp && zip -rq {{.LambdaSourceCodeDirectory}}-{{.Version}}.zip . | |
- cd temp && aws s3 cp {{.LambdaSourceCodeDirectory}}-{{.Version}}.zip s3://{{.LambdaS3Bucket}}/{{.LambdaSourceCodeDirectory}}/{{.LambdaSourceCodeDirectory}}-{{.Version}}.zip | |
- echo $'\n🧹 Deleting Temp Files' | |
- rm -r temp | |
vars: | |
ACCOUNT: | |
sh: aws sts get-caller-identity |jq -r .Account | |
silent: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment