Last active
October 21, 2022 04:25
-
-
Save dmvianna/8a835bb69b0781c6411330257fbcee85 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -e | |
# | |
# This script uses poetry to bundle all the dependencies | |
# found in `pyproject.toml` into a zip file that can be | |
# then uploaded to AWS Lambda. | |
# | |
if [ -f artifact.zip ] ; then | |
rm artifact.zip | |
fi | |
if [ -d ./package ] ; then | |
rm -rf ./package | |
fi | |
mkdir -p ./package | |
poetry export \ | |
--without-hashes \ | |
--without test,dev \ | |
--format requirements.txt \ | |
--output ./package/requirements.txt | |
pip install \ | |
--requirement ./package/requirements.txt \ | |
--target ./package | |
cp -r ./<MODULE NAME> ./package | |
cd ./package | |
zip \ | |
--recurse-paths \ | |
../artifact.zip \ | |
. \ | |
--exclude "*.pyc" \ | |
--exclude ".*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment