Created
August 29, 2023 22:59
-
-
Save TheFern2/39bd9876c3e20e77e66e61e28d212379 to your computer and use it in GitHub Desktop.
create aws python layer
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
#!/bin/bash | |
LAYERS_HOME=~/aws/layers | |
PACKAGE_NAME="$1" | |
mkdir -p $LAYERS_HOME/zip/$PACKAGE_NAME $LAYERS_HOME/tmp | |
python3.11 -m pip install -t $LAYERS_HOME/python_$PACKAGE_NAME $PACKAGE_NAME | |
current_epoch=$(date '+%s') | |
# copy package into a python named tmp dir | |
tmp_dir=$LAYERS_HOME/tmp/$current_epoch/layer_$PACKAGE_NAME/python/ | |
cd_dir=$LAYERS_HOME/tmp/$current_epoch/layer_$PACKAGE_NAME/ | |
mkdir -p $tmp_dir | |
cp -r $LAYERS_HOME/python_$PACKAGE_NAME/. $tmp_dir | |
cd $cd_dir | |
zip -q -r $LAYERS_HOME/zip/$PACKAGE_NAME/python.zip ./* | |
cd - | |
#sleep 30 | |
# clean tmp dir | |
rm -rf $LAYERS_HOME/tmp/ |
Author
TheFern2
commented
Aug 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment