Skip to content

add support for python 3.12 and 3.13 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,31 @@ 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
docker build \
--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}
Expand Down
15 changes: 9 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

Expand All @@ -24,6 +30,3 @@
## 2023-10-23

- update Python 3.11 base image (author @philvarner, https://github.com/lambgeo/docker-lambda/pull/60)



6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ see: <https://github.com/lambgeo/docker-lambda/pkgs/container/lambda-gdal>
#### 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}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"

Expand Down Expand Up @@ -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/
Expand Down
20 changes: 11 additions & 9 deletions dockerfiles/runtimes/python
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"

Expand All @@ -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/
Expand All @@ -42,4 +44,4 @@ RUN export GDAL_VERSION=$(gdal-config --version)

RUN mkdir ${PREFIX}/python

ENTRYPOINT bash
ENTRYPOINT [ "bash" ]
23 changes: 14 additions & 9 deletions scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down