Skip to content
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

refactor parameterize #65

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
gdal-version: [3.6]
gdal-version: ["3.8.0"]
steps:
- uses: actions/checkout@v4

Expand All @@ -35,22 +35,24 @@ jobs:
python -m pip install boto3 click

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

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

- name: Build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: .
load: true
file: dockerfiles/Dockerfile.gdal${{ matrix.gdal-version }}
file: dockerfiles/Dockerfile
build-args: |
GDAL_VERSION=${{ matrix.gdal-version }}
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ matrix.gdal-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down Expand Up @@ -89,11 +91,13 @@ jobs:
aws-region: us-east-1

- name: Publish docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.gdal${{ matrix.gdal-version }}
file: dockerfiles/Dockerfile
build-args: |
GDAL_VERSION=${{ matrix.gdal-version }}
push: true
cache-from: type=gha
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ matrix.gdal-version }}
Expand Down Expand Up @@ -135,7 +139,7 @@ jobs:
- uses: actions/setup-node@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -147,7 +151,7 @@ jobs:
python scripts/list.py | jq > layer.json

- name: Update resources
uses: test-room-7/action-update-file@v1
uses: test-room-7/action-update-file@v1.8.0
with:
file-path: layer.json
commit-msg: Update layer [skip ci]
Expand Down
6 changes: 4 additions & 2 deletions dockerfiles/Dockerfile.gdal3.6 → dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,11 @@ RUN mkdir /tmp/netcdf \
# We use commit sha to make sure we are not using `cache` when building the docker image
# "7ca88116f5a46d429251361634eb24629f315076" is the latest commit on release/3.6 branch

# gdal

# GDAL
ARG GDAL_VERSION
RUN mkdir /tmp/gdal \
&& curl -sfL https://github.com/OSGeo/gdal/archive/7ca88116f5a46d429251361634eb24629f315076.tar.gz | tar zxf - -C /tmp/gdal --strip-components=1 \
&& curl -sfL https://github.com/OSGeo/gdal/archive/refs/tags/v${GDAL_VERSION}.tar.gz | tar zxf - -C /tmp/gdal --strip-components=1 \
&& cd /tmp/gdal \
&& mkdir build && cd build \
&& cmake3 .. \
Expand Down
8 changes: 5 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

GDAL_VERSION=$1
GDAL_VERSION_TAG=${GDAL_VERSION%.*}
RUNTIME=$2
RUNTIME_VERSION=$3

echo "Building image for AWS Lambda | GDAL: ${GDAL_VERSION} | Runtime: ${RUNTIME}:${RUNTIME_VERSION}"

docker buildx build \
--platform=linux/amd64 \
-f dockerfiles/Dockerfile.gdal${GDAL_VERSION} \
-t ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION} .
--build-arg GDAL_VERSION=${GDAL_VERSION} \
-f dockerfiles/Dockerfile \
-t ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION_TAG} .
vincentsarago marked this conversation as resolved.
Show resolved Hide resolved

docker buildx build \
--platform=linux/amd64 \
--build-arg GDAL_VERSION=${GDAL_VERSION} \
--build-arg RUNTIME_VERSION=${RUNTIME_VERSION} \
-f dockerfiles/runtimes/${RUNTIME} \
-t ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION}-${RUNTIME}${RUNTIME_VERSION} .
-t ghcr.io/lambgeo/lambda-gdal:${GDAL_VERSION_TAG}-${RUNTIME}${RUNTIME_VERSION} .