Skip to content

Commit 31f8ee3

Browse files
committed
enable installation of patch releases in lambda image
also, enables building of multiple images for each release of the Python API, for alternate python versions
1 parent 3f2ddbd commit 31f8ee3

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

.github/workflows/DockerBuild.LambdaBaseImage.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ name: DockerBuild.LambdaImage
33
on:
44
# allow it to be run on-demand
55
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: "Version of ArcGIS API for Python to install in the image"
9+
type: string
10+
default: "2.2.0"
11+
python_version:
12+
description: "Python version to base image on"
13+
type: string
14+
default: "3.9"
15+
is_latest_release:
16+
description: "Version of ArcGIS API for Python is Latest current release"
17+
type: boolean
18+
default: false
19+
is_default_supported_python:
20+
description: "Python version is default supported version (i.e. python used by Pro and Enterprise)"
21+
type: boolean
22+
default: false
623

724
jobs:
825
build-and-push:
@@ -31,10 +48,10 @@ jobs:
3148
images: |
3249
ghcr.io/esri/arcgis-python-api-lambda
3350
tags: |
34-
type=raw,value=2.2.0,enable={{is_default_branch}}
35-
type=raw,value=latest,enable={{is_default_branch}}
36-
type=schedule,pattern={{date 'YY.MM'}},enable={{is_default_branch}}
37-
type=sha,format=long
51+
type=raw,value=${{ inputs.version }}-python${{ inputs.python_version }}
52+
type=raw,value=${{ inputs.version }},enable=${{ inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
53+
type=raw,value=latest,enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
54+
type=schedule,pattern={{date 'YY.MM'}},enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
3855
3956
- id: docker_build
4057
name: Build image and push to GitHub Container Registry
@@ -43,6 +60,9 @@ jobs:
4360
# relative path to the place where source code with Dockerfile is located
4461
context: .
4562
file: ./docker/LambdaBaseImage.Dockerfile
63+
build-args: |
64+
python_version=${{ inputs.python_version }}
65+
arcgis_version=${{ inputs.version }}
4666
tags: ${{ steps.meta.outputs.tags }}
4767
provenance: false
4868
platforms: linux/amd64

docker/LambdaBaseImage.Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG PYTHON_VERSION=3.9
1+
ARG python_version=3.9
22
# lambda python image, defaults to python 3.9
3-
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
3+
FROM public.ecr.aws/lambda/python:${python_version}
44

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

0 commit comments

Comments
 (0)