Skip to content

Commit

Permalink
enable installation of patch releases in lambda image
Browse files Browse the repository at this point in the history
also, enables building of multiple images for each release of the Python API, for alternate python versions
  • Loading branch information
jtroe committed Dec 13, 2023
1 parent 3f2ddbd commit 31f8ee3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/DockerBuild.LambdaBaseImage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ name: DockerBuild.LambdaImage
on:
# allow it to be run on-demand
workflow_dispatch:
inputs:
version:
description: "Version of ArcGIS API for Python to install in the image"
type: string
default: "2.2.0"
python_version:
description: "Python version to base image on"
type: string
default: "3.9"
is_latest_release:
description: "Version of ArcGIS API for Python is Latest current release"
type: boolean
default: false
is_default_supported_python:
description: "Python version is default supported version (i.e. python used by Pro and Enterprise)"
type: boolean
default: false

jobs:
build-and-push:
Expand Down Expand Up @@ -31,10 +48,10 @@ jobs:
images: |
ghcr.io/esri/arcgis-python-api-lambda
tags: |
type=raw,value=2.2.0,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=schedule,pattern={{date 'YY.MM'}},enable={{is_default_branch}}
type=sha,format=long
type=raw,value=${{ inputs.version }}-python${{ inputs.python_version }}
type=raw,value=${{ inputs.version }},enable=${{ inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
type=raw,value=latest,enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
type=schedule,pattern={{date 'YY.MM'}},enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
- id: docker_build
name: Build image and push to GitHub Container Registry
Expand All @@ -43,6 +60,9 @@ jobs:
# relative path to the place where source code with Dockerfile is located
context: .
file: ./docker/LambdaBaseImage.Dockerfile
build-args: |
python_version=${{ inputs.python_version }}
arcgis_version=${{ inputs.version }}
tags: ${{ steps.meta.outputs.tags }}
provenance: false
platforms: linux/amd64
Expand Down
8 changes: 4 additions & 4 deletions docker/LambdaBaseImage.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTHON_VERSION=3.9
ARG python_version=3.9
# lambda python image, defaults to python 3.9
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
FROM public.ecr.aws/lambda/python:${python_version}

# set metadata
LABEL org.opencontainers.image.authors="[email protected]"
Expand All @@ -11,8 +11,8 @@ LABEL org.opencontainers.image.source=https://github.com/esri/arcgis-python-api
# install dependencies, then clean yum cache
RUN yum -y install gcc krb5-devel krb5-server krb5-libs && yum clean all && rm -rf /var/cache/yum
# install arcgis
ARG ARCGIS_PYTHON_VERSION=2.2.0
RUN pip3 install arcgis==${ARCGIS_PYTHON_VERSION} --target "${LAMBDA_TASK_ROOT}"
ARG arcgis_version="2.2.0"
RUN pip3 install "arcgis==${arcgis_version}.*" --target "${LAMBDA_TASK_ROOT}"
# set entrypoint to app.py handler method
# (note that app.py is missing from this base image)
CMD [ "app.handler" ]
Expand Down

0 comments on commit 31f8ee3

Please sign in to comment.