|
|
@ -3,17 +3,17 @@ |
|
|
|
IMAGE_NAME=python_aws_layer.image |
|
|
|
IMAGE_NAME=python_aws_layer.image |
|
|
|
CONTAINER_NAME=python_aws_layer.container |
|
|
|
CONTAINER_NAME=python_aws_layer.container |
|
|
|
|
|
|
|
|
|
|
|
docker buildx build . -t $IMAGE_NAME:latest |
|
|
|
docker build . -t $IMAGE_NAME:latest |
|
|
|
# check if container exists |
|
|
|
# check if container exists |
|
|
|
if [ ! "$(docker ps -a -q -f name=$CONTAINER_NAME)" ]; then |
|
|
|
if [ "$(docker ps -a -q -f name=$CONTAINER_NAME)" ]; then |
|
|
|
# check if it exited |
|
|
|
# cleanup |
|
|
|
if [ "$(docker ps -aq -f status=exited -f name=$CONTAINER_NAME)" ]; then |
|
|
|
docker rm $CONTAINER_NAME |
|
|
|
# cleanup |
|
|
|
|
|
|
|
docker rm $CONTAINER_NAME |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
# run your container |
|
|
|
|
|
|
|
docker run --name $CONTAINER_NAME $IMAGE_NAME |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
docker run \ |
|
|
|
|
|
|
|
--name $CONTAINER_NAME \ |
|
|
|
|
|
|
|
--platform linux/amd64 \ |
|
|
|
|
|
|
|
-dit \ |
|
|
|
|
|
|
|
$IMAGE_NAME |
|
|
|
|
|
|
|
|
|
|
|
docker cp $CONTAINER_NAME:/usr/src/app/python.zip . |
|
|
|
docker cp $CONTAINER_NAME:/usr/src/app/python.zip . |
|
|
|
docker stop $CONTAINER_NAME |
|
|
|
docker stop $CONTAINER_NAME |
|
|
|