Create a zip file necessary as a AWS Layer for Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
466 B

1 year ago
#!/bin/bash
IMAGE_NAME=python_aws_layer.image
CONTAINER_NAME=python_aws_layer.container
1 year ago
docker build . -t $IMAGE_NAME:latest
1 year ago
# check if container exists
1 year ago
if [ "$(docker ps -a -q -f name=$CONTAINER_NAME)" ]; then
# cleanup
docker rm $CONTAINER_NAME
1 year ago
fi
1 year ago
docker run \
--name $CONTAINER_NAME \
--platform linux/amd64 \
-dit \
$IMAGE_NAME
1 year ago
docker cp $CONTAINER_NAME:/usr/src/app/python.zip .
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME