Skip to content

Instantly share code, notes, and snippets.

@umihico
Last active December 20, 2019 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umihico/8b1082980f29c9d72c69ff0a937f6ce8 to your computer and use it in GitHub Desktop.
Save umihico/8b1082980f29c9d72c69ff0a937f6ce8 to your computer and use it in GitHub Desktop.
publish python layer in AWS Lambda easily
version: '3'
services:
app:
image: lambci/lambda:build-python3.7
volumes:
- '.:/var/task'
working_dir: /var/task
command: bash -c 'mkdir python && pip install -r requirements.txt -t ./python lxml && zip -r layer.zip python && rm -rf python'
wget https://gist.githubusercontent.com/umihico/8b1082980f29c9d72c69ff0a937f6ce8/raw/docker-compose.yml
echo $1>requirements.txt
docker-compose up
aws lambda publish-layer-version --layer-name $1 --zip-file fileb://layer.zip --compatible-runtimes python3.7
rm -rf layer.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment