Skip to content

Commit

Permalink
updates for multiarch and refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Feb 9, 2024
1 parent 2406230 commit 9aa43e5
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ENV LD_LIBRARY_PATH=${CONDAENV}/lib
# we're running our own conda one
RUN rm /usr/bin/python

RUN python -m pip install awslambdaric==2.0.0
RUN python -m pip install awslambdaric==2.0.8
ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-${RIE_ARCH} /usr/bin/aws-lambda-rie

RUN chmod +x /usr/bin/aws-lambda-rie
Expand Down
33 changes: 33 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,41 @@ PDAL Lambda Container for AWS
Instructions
--------------------------------------------------------------------------------


Note that this set of scripts has only been run on an M1/M2 Mac. Multi-arch
containers are often quite slow.

0. Set your AWS variables into your environment:

::

AWS_ACCESS_KEY_ID=something
AWS_SECRET_ACCESS_KEY=somethingelse
AWS_DEFAULT_REGION=us-east-1

1. Build the containers. It should make both an arm64 and amd64 image

::

$ ./build.sh pdal-lambda

2. Create an ECR repository in your account for the ``pdal-lambda``
image

::

aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION
aws ecr create-repository \
--repository-name pdal-lambda \
--region $AWS_DEFAULT_REGION

3. Build the containers. It should make both an arm64 and amd64 image

::

$ ./build.sh pdal-lambda

4. Push the containers

::
$ ./push.sh pdal-lambda
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ docker buildx build -t $CONTAINER_NAME:amd64 . \
--platform linux/amd64 \
-f Dockerfile --load

LAMBDA_IMAGE="amazon/aws-lambda-provided:al2.2022.03.02.08"
LAMBDA_IMAGE="amazon/aws-lambda-provided:al2.2023.12.14.13"
docker buildx build -t $CONTAINER_NAME:arm64 . \
-f Dockerfile --platform linux/arm64 \
--build-arg LAMBDA_IMAGE=$LAMBDA_IMAGE \
Expand Down
29 changes: 23 additions & 6 deletions push.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
#!/bin/sh

container="$1"
tag="$2"

if [ -z "$container" ]
then
echo "container name not set! please execute ./build.sh containername'"
exit
fi
region="$AWS_DEFAULT_REGION"
echo "region: $region"
echo "region: ${region}"

# login to docker
eval $(aws ecr get-login --no-include-email --region $region)
eval $(aws ecr get-login --no-include-email --region ${region})
identity=$(aws sts get-caller-identity --query 'Account' --output text)

repository=$(aws ecr describe-repositories --repository-names $container)
echo "repository: ${repository}"


CONTAINER_NAME=$identity.dkr.ecr.$region.amazonaws.com/$container:$tag
echo $CONTAINER_NAME
docker push "$CONTAINER_NAME"
for tag in amd64 arm64;
do
echo $Item
CONTAINER_NAME=${identity}.dkr.ecr.${region}.amazonaws.com/${container}:$tag
echo $CONTAINER_NAME
docker push "$CONTAINER_NAME"
done



CONTAINER_NAME=${identity}.dkr.ecr.${region}.amazonaws.com/${container}:latest
docker manifest create "$CONTAINER_NAME" \
--amend "${identity}.dkr.ecr.${region}.amazonaws.com/${container}:arm64" \
--amend "${identity}.dkr.ecr.${region}.amazonaws.com/${container}:x86_64"

docker manifest inspect $CONTAINER_NAME

docker manifest push "$CONTAINER_NAME"
2 changes: 1 addition & 1 deletion run-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- pdal
- python-pdal
- python=3.9
- python=3.11
- entwine
- aws-sdk-cpp
- Shapely
Expand Down

0 comments on commit 9aa43e5

Please sign in to comment.