diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d50eb1..5e3299d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,7 @@ jobs: /local/scripts/create-layer.sh python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --deploy - - name: Build Runtime and Push + - name: Build Runtime and Push Python <=3.11 with yum run: | runtimes='3.9 3.10 3.11' for runtime in ${runtimes}; do @@ -127,6 +127,23 @@ jobs: --platform=linux/amd64 \ --build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }} \ --build-arg RUNTIME_VERSION=${runtime} \ + --build-arg NUMPY_VERSION=1.25 \ + --build-arg PKG_INSTALLER=yum \ + -f dockerfiles/runtimes/python \ + -t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} . + docker push ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} + done + + - name: Build Runtime and Push Python >= 3.12 with dnf + run: | + runtimes='3.12 3.13' + for runtime in ${runtimes}; do + docker build \ + --platform=linux/amd64 \ + --build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }} \ + --build-arg RUNTIME_VERSION=${runtime} \ + --build-arg NUMPY_VERSION=1.26 \ + --build-arg PKG_INSTALLER=dnf \ -f dockerfiles/runtimes/python \ -t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} . docker push ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} diff --git a/CHANGES.md b/CHANGES.md index b4ca528..95beea9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +# Changelog + +## Unreleased + +- Add support for Python 3.12 and 3.13 +- Update deploy.py script compatible runtimes list to currently-available runtimes ## 2024-02-02.patch1 @@ -6,9 +12,9 @@ ## 2024-02-02 - update versions (author @philvarner, https://github.com/lambgeo/docker-lambda/pull/76): - - GDAL: 3.8.3 - - GEOS: 3.12.1 - - PROJ: 9.3.1 + - GDAL: 3.8.3 + - GEOS: 3.12.1 + - PROJ: 9.3.1 - fix `libsqlite3` lib links (author @jasongi, https://github.com/lambgeo/docker-lambda/pull/75) @@ -24,6 +30,3 @@ ## 2023-10-23 - update Python 3.11 base image (author @philvarner, https://github.com/lambgeo/docker-lambda/pull/60) - - - diff --git a/README.md b/README.md index 8803955..b593389 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ see: #### 1. Create Dockerfile ```Dockerfile -FROM ghcr.io/lambgeo/lambda-gdal:3.8 as gdal +FROM ghcr.io/lambgeo/lambda-gdal:3.8 AS gdal # We use the official AWS Lambda image FROM public.ecr.aws/lambda/{RUNTIME: python|node|go...}:{RUNTIME version} @@ -69,7 +69,7 @@ ENV \ RUN cd $PACKAGE_PREFIX && zip -r9q /tmp/package.zip * ``` -If you are working with **python3.9|3.10|3.11**, you can use lambgeo pre-build docker images: +If you are working with **python3.9|3.10|3.11|3.12|3.13**, you can use lambgeo pre-build docker images: ```Dockerfile FROM ghcr.io/lambgeo/lambda-gdal:3.8-python3.10 @@ -218,7 +218,7 @@ If your lambda handler needs more dependencies you'll have to use the exact same ##### Create a Dockerfile ```dockerfile -FROM ghcr.io/lambgeo/lambda-gdal:3.8 as gdal +FROM ghcr.io/lambgeo/lambda-gdal:3.8 AS gdal # This example assume that you are creating a lambda package for python 3.10 FROM public.ecr.aws/lambda/python:3.10 diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 40e02c0..5875f15 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/lambda/provided:al2 as builder +FROM public.ecr.aws/lambda/provided:al2 AS builder LABEL maintainer="lambgeo " @@ -402,7 +402,7 @@ RUN for i in $PREFIX/bin/*; do patchelf --force-rpath --set-rpath '$ORIGIN/../li RUN for i in $PREFIX/lib/*.so; do patchelf --force-rpath --set-rpath '$ORIGIN' $i; done # Build final image -FROM public.ecr.aws/lambda/provided:al2 as runner +FROM public.ecr.aws/lambda/provided:al2 AS runner ENV PREFIX /opt COPY --from=builder /opt/lib/ $PREFIX/lib/ diff --git a/dockerfiles/runtimes/python b/dockerfiles/runtimes/python index a666c62..001da19 100644 --- a/dockerfiles/runtimes/python +++ b/dockerfiles/runtimes/python @@ -1,9 +1,11 @@ -ARG GDAL_VERSION_TAG -ARG RUNTIME_VERSION +ARG GDAL_VERSION_TAG=x +ARG RUNTIME_VERSION=x -FROM ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION_TAG} as gdal +FROM ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION_TAG} AS gdal FROM public.ecr.aws/lambda/python:${RUNTIME_VERSION} +ARG PKG_INSTALLER +ARG NUMPY_VERSION LABEL maintainer="lambgeo " @@ -12,19 +14,19 @@ ENV \ LC_ALL=en_US.UTF-8 \ CFLAGS="--std=c99" -RUN yum install -y gcc gcc-c++ && \ - yum clean all && \ - rm -rf /var/cache/yum /var/lib/yum/history +RUN ${PKG_INSTALLER} install -y gcc gcc-c++ && \ + ${PKG_INSTALLER} clean all RUN \ python -m pip install pip -U \ - && python -m pip install cython numpy==1.25 wheel --no-binary numpy + && python -m pip install --upgrade setuptools \ + && python -m pip install cython numpy==${NUMPY_VERSION} wheel --no-binary numpy # The PREFIX should be the same as in gdal{version}:latest # When building rasterio, setup.py will get libs directoy from gdal-config # $ gdal-config --libs # -L/opt/lib -lgdal -ENV PREFIX /opt +ENV PREFIX=/opt COPY --from=gdal /opt/lib/ $PREFIX/lib/ COPY --from=gdal /opt/include/ $PREFIX/include/ @@ -42,4 +44,4 @@ RUN export GDAL_VERSION=$(gdal-config --version) RUN mkdir ${PREFIX}/python -ENTRYPOINT bash +ENTRYPOINT [ "bash" ] diff --git a/scripts/deploy.py b/scripts/deploy.py index 8aae9df..e12cf99 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -26,18 +26,23 @@ CompatibleRuntimes_al2 = [ - "nodejs12.x", - "nodejs14.x", - "nodejs16.x", + "nodejs22.x", + "nodejs20.x", + "nodejs18.x", + "python3.13", + "python3.12", + "python3.11", + "python3.10", + "python3.9", + "java21", + "java17", "java11", "java8.al2", - "python3.8", - "python3.9", - "python3.10", - "python3.11", + "dotnet8", "dotnet6", - "dotnetcore3.1", - "ruby2.7", + "ruby3.3", + "ruby3.2", + "provided.al2023", "provided.al2", ]