Skip to content
Draft
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
147 changes: 118 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ on:
pull_request:

env:
GDAL_VERSION: 3.8.3
GDAL_VERSION_TAG: 3.8
GDAL_VERSION_AL2: 3.8.3
GDAL_VERSION_TAG_AL2: 3.8
GDAL_VERSION_AL2023: 3.11.5
GDAL_VERSION_TAG_AL2023: 3.11

jobs:
build:
build-al2:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4

- name: Set registry owner
run: |
owner="${{ github.repository_owner }}"
echo "REGISTRY_OWNER=${owner,,}" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -45,35 +52,93 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
- name: Build AL2
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
load: true
file: dockerfiles/Dockerfile
build-args: |
GDAL_VERSION=${{ env.GDAL_VERSION }}
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
GDAL_VERSION=${{ env.GDAL_VERSION_AL2 }}
tags: ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-al2
cache-from: type=gha,scope=al2
cache-to: type=gha,mode=max,scope=al2

- name: Test
- name: Test AL2
run: |
docker run \
--platform=linux/amd64 \
--entrypoint bash \
-v ${{ github.workspace }}:/local \
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
--rm ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-al2 \
/local/tests/tests.sh

build-al2023:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4

- name: Set registry owner
run: |
owner="${{ github.repository_owner }}"
echo "REGISTRY_OWNER=${owner,,}" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install boto3 click

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build AL2023
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
load: true
file: dockerfiles/Dockerfile.al2023
build-args: |
GDAL_VERSION=${{ env.GDAL_VERSION_AL2023 }}
tags: ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023
cache-from: type=gha,scope=al2023
cache-to: type=gha,mode=max,scope=al2023

- name: Test AL2023
run: |
docker run \
--platform=linux/amd64 \
--entrypoint bash \
-v ${{ github.workspace }}:/local \
--rm ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023 \
/local/tests/tests.sh

deploy:
needs: [build]
needs: [build-al2, build-al2023]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags') && github.event_name == 'push'
steps:
- uses: actions/checkout@v4

- name: Set registry owner
run: |
owner="${{ github.repository_owner }}"
echo "REGISTRY_OWNER=${owner,,}" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -96,57 +161,81 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Publish docker image
- name: Publish AL2 docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile
build-args: |
GDAL_VERSION=${{ env.GDAL_VERSION }}
GDAL_VERSION=${{ env.GDAL_VERSION_AL2 }}
push: true
cache-from: type=gha
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}
cache-from: type=gha,scope=al2
tags: |
ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-al2
ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}

- name: Build and Deploy layers
- name: Publish AL2023 docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.al2023
build-args: |
GDAL_VERSION=${{ env.GDAL_VERSION_AL2023 }}
push: true
cache-from: type=gha,scope=al2023
tags: ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023

- name: Build and Deploy layers (AL2)
run: |
python -m pip install boto3 click
docker run \
--platform=linux/amd64 \
--entrypoint bash \
-v ${{ github.workspace }}:/local \
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
--rm ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-al2 \
/local/scripts/create-layer.sh
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG_AL2 }} --deploy

- name: Build and Deploy layers (AL2023)
run: |
docker run \
--platform=linux/amd64 \
--entrypoint bash \
-v ${{ github.workspace }}:/local \
--rm ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023 \
/local/scripts/create-layer.sh
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --deploy
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023 --deploy

- name: Build Runtime and Push Python <=3.11 with yum
- name: Build Runtime and Push Python 3.10-3.11 (AL2)
run: |
runtimes='3.9 3.10 3.11'
runtimes='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 GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG_AL2 }}-al2 \
--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}
-t ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-python${runtime} .
docker push ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2 }}-python${runtime}
done

- name: Build Runtime and Push Python >= 3.12 with dnf
- name: Build Runtime and Push Python 3.12-3.14 (AL2023)
run: |
runtimes='3.12 3.13'
runtimes='3.12 3.13 3.14'
for runtime in ${runtimes}; do
docker build \
--platform=linux/amd64 \
--build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }} \
--build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG_AL2023 }}-al2023 \
--build-arg RUNTIME_VERSION=${runtime} \
--build-arg NUMPY_VERSION=1.26 \
--build-arg NUMPY_VERSION=2.3.5 \
--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}
-t ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-python${runtime} .
docker push ghcr.io/${{ env.REGISTRY_OWNER }}/lambda-gdal:${{ env.GDAL_VERSION_TAG_AL2023 }}-python${runtime}
done

update-layer:
Expand Down
6 changes: 3 additions & 3 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ RUN yum update -y && \
yum clean all && \
rm -rf /var/cache/yum /var/lib/yum/history

ENV PREFIX /opt
ENV PREFIX=/opt

WORKDIR /opt

ENV LD_LIBRARY_PATH $PREFIX/lib:$LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH

# pkg-config
ENV PKGCONFIG_VERSION=0.29.2
Expand Down Expand Up @@ -404,7 +404,7 @@ RUN for i in $PREFIX/lib/*.so; do patchelf --force-rpath --set-rpath '$ORIGIN' $
# Build final image
FROM public.ecr.aws/lambda/provided:al2 AS runner

ENV PREFIX /opt
ENV PREFIX=/opt
COPY --from=builder /opt/lib/ $PREFIX/lib/
COPY --from=builder /opt/include/ $PREFIX/include/
COPY --from=builder /opt/share/ $PREFIX/share/
Expand Down
Loading