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

enable installation of patch releases in lambda image #1728

Merged
merged 1 commit into from
Dec 13, 2023
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
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