Skip to content

Commit 00f101d

Browse files
author
Neha Sharma
committed
Merge branch 'master' of https://github.com/Esri/arcgis-python-api into notebook_automation
2 parents 026b7c8 + 695a3e1 commit 00f101d

27 files changed

+400
-86
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: DockerBuild.AzureFunctionsImage
2+
3+
permissions:
4+
contents: read
5+
packages: write
6+
7+
on:
8+
# allow it to be run on-demand
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: "Version of ArcGIS API for Python to install in the image"
13+
type: string
14+
default: "2.3.1"
15+
python_version:
16+
description: "Python version to base image on"
17+
type: string
18+
default: "3.11"
19+
is_latest_release:
20+
description: "Version of ArcGIS API for Python is Latest current release"
21+
type: boolean
22+
default: false
23+
is_default_supported_python:
24+
description: "Python version is default supported version (i.e. python used by Pro and Enterprise)"
25+
type: boolean
26+
default: false
27+
28+
jobs:
29+
build-and-push:
30+
name: Build Docker image and push to ghcr.io
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Docker Buildx
38+
id: buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Login to Github Packages
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Docker meta
49+
id: meta
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: |
53+
ghcr.io/esri/arcgis-python-api-azure-functions
54+
tags: |
55+
type=raw,value=${{ inputs.version }}-python${{ inputs.python_version }}
56+
type=raw,value=${{ inputs.version }},enable=${{ inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
57+
type=raw,value=latest,enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
58+
type=schedule,pattern={{date 'YY.MM'}},enable=${{ inputs.is_latest_release && inputs.is_default_supported_python && github.ref_name == github.event.repository.default_branch }}
59+
60+
- id: docker_build
61+
name: Build image and push to GitHub Container Registry
62+
uses: docker/build-push-action@v6
63+
with:
64+
# relative path to the place where source code with Dockerfile is located
65+
context: .
66+
file: ./docker/AzureFunctionsBaseImage.Dockerfile
67+
build-args: |
68+
python_version=${{ inputs.python_version }}
69+
arcgis_version=${{ inputs.version }}
70+
tags: ${{ steps.meta.outputs.tags }}
71+
provenance: false
72+
platforms: linux/amd64
73+
push: true

.github/workflows/DockerBuild.LambdaBaseImage.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: DockerBuild.LambdaImage
22

3+
permissions:
4+
contents: read
5+
packages: write
6+
37
on:
48
# allow it to be run on-demand
59
workflow_dispatch:
610
inputs:
711
version:
812
description: "Version of ArcGIS API for Python to install in the image"
913
type: string
10-
default: "2.3.0"
14+
default: "2.3.1"
1115
python_version:
1216
description: "Python version to base image on"
1317
type: string
@@ -28,22 +32,22 @@ jobs:
2832

2933
steps:
3034
- name: Checkout code
31-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3236

3337
- name: Set up Docker Buildx
3438
id: buildx
35-
uses: docker/setup-buildx-action@v2
39+
uses: docker/setup-buildx-action@v3
3640

3741
- name: Login to Github Packages
38-
uses: docker/login-action@v2
42+
uses: docker/login-action@v3
3943
with:
4044
registry: ghcr.io
4145
username: ${{ github.actor }}
4246
password: ${{ secrets.GITHUB_TOKEN }}
4347

4448
- name: Docker meta
4549
id: meta
46-
uses: docker/metadata-action@v4
50+
uses: docker/metadata-action@v5
4751
with:
4852
images: |
4953
ghcr.io/esri/arcgis-python-api-lambda
@@ -55,7 +59,7 @@ jobs:
5559
5660
- id: docker_build
5761
name: Build image and push to GitHub Container Registry
58-
uses: docker/build-push-action@v4
62+
uses: docker/build-push-action@v6
5963
with:
6064
# relative path to the place where source code with Dockerfile is located
6165
context: .

.github/workflows/DockerBuild.NotebookImage.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
name: DockerBuild.NotebookImage
22

3+
permissions:
4+
contents: read
5+
packages: write
6+
37
on:
48
# allow it to be run on-demand
59
workflow_dispatch:
610
inputs:
711
version:
812
description: "Version of ArcGIS API for Python to install in the image"
913
type: string
10-
default: "2.2.0"
14+
default: "2.3.1"
1115
python_version:
1216
description: "Python version to base image on"
1317
type: string
14-
default: "3.9"
18+
default: "3.11"
1519
is_latest_release:
1620
description: "Version of ArcGIS API for Python is Latest current release"
1721
type: boolean
@@ -32,18 +36,18 @@ jobs:
3236

3337
- name: Set up Docker Buildx
3438
id: buildx
35-
uses: docker/setup-buildx-action@v2
39+
uses: docker/setup-buildx-action@v3
3640

3741
- name: Login to Github Packages
38-
uses: docker/login-action@v2
42+
uses: docker/login-action@v3
3943
with:
4044
registry: ghcr.io
4145
username: ${{ github.actor }}
4246
password: ${{ secrets.GITHUB_TOKEN }}
4347

4448
- name: Docker meta
4549
id: meta
46-
uses: docker/metadata-action@v4
50+
uses: docker/metadata-action@v5
4751
with:
4852
images: |
4953
ghcr.io/esri/arcgis-python-api-notebook
@@ -55,7 +59,7 @@ jobs:
5559
5660
- id: docker_build
5761
name: Build image and push to GitHub Container Registry
58-
uses: docker/build-push-action@v4
62+
uses: docker/build-push-action@v6
5963
with:
6064
# relative path to the place where source code with Dockerfile is located
6165
context: ./docker
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG python_version=3.11
2+
# azure-functions python image, defaults to python 3.11
3+
FROM mcr.microsoft.com/azure-functions/python:4-python${python_version}
4+
5+
# set metadata
6+
LABEL org.opencontainers.image.authors="[email protected]"
7+
LABEL org.opencontainers.image.description="Azure Functions image with arcgis Python API and its Linux dependencies preinstalled"
8+
LABEL org.opencontainers.image.licenses=Apache
9+
LABEL org.opencontainers.image.source=https://github.com/esri/arcgis-python-api
10+
11+
# install dependencies, then clean yum cache
12+
RUN apt-get update && apt-get install -y gcc libkrb5-dev krb5-config krb5-user && apt-get clean && rm -rf /var/lib/apt/lists/*
13+
RUN pip3 install azure-functions && rm -rf /home/.cache/pip
14+
# install arcgis
15+
ARG arcgis_version="2.3.1"
16+
# adding .* ensures the latest patch version is installed
17+
RUN pip3 install "arcgis==${arcgis_version}.*" && rm -rf /home/.cache/pip

docker/LambdaBaseImage.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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 gcc-c++ krb5-devel krb5-server krb5-libs && yum clean all && rm -rf /var/cache/yum
1313
# install arcgis
14-
ARG arcgis_version="2.3.0"
14+
ARG arcgis_version="2.3.1"
1515
# adding .* ensures the latest patch version is installed
1616
RUN pip3 install "arcgis==${arcgis_version}.*" --target "${LAMBDA_TASK_ROOT}" && rm -rf /root/.cache/pip
1717
# set entrypoint to app.py handler method

docker/NotebookImage.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG python_version="3.9"
2-
FROM jupyter/base-notebook:python-${python_version}
1+
ARG python_version="3.11"
2+
FROM quay.io/jupyter/base-notebook:python-${python_version}
33

44
ARG python_version
5-
ARG arcgis_version="2.2.0"
5+
ARG arcgis_version="2.3.1"
66
ARG sampleslink="https://github.com/Esri/arcgis-python-api/releases/download/v${arcgis_version}/samples.zip"
77
ARG githubfolder="arcgis-python-api"
88
ENV DOCKER_STACKS_JUPYTER_CMD="notebook"

docker/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Some useful docker images for utilizing the ArcGIS API for Python in your workfl
88

99
To use this image, setup your dockerfile like:
1010
```
11-
FROM ghcr.io/esri/arcgis-python-api-lambda
11+
FROM ghcr.io/esri/arcgis-python-api-lambda:latest
1212
COPY app.py ${LAMBDA_TASK_ROOT}
1313
```
1414

@@ -24,3 +24,39 @@ def handler(event, context):
2424
```
2525

2626
Push to your _private_ AWS ECR instance, and configure lambda to run from this container image. As of this writing, public AWS ECR instances are not supported for lambda.
27+
28+
## AzureFunctionsBaseImage
29+
30+
#### ghcr.io/esri/arcgis-python-api-azure-functions:latest
31+
32+
[Sample](samples/AzureFunctions)
33+
34+
To use this image, setup your dockerfile like
35+
```
36+
FROM ghcr.io/esri/arcgis-python-api-azure-functions:latest
37+
COPY . /home/site/wwwroot
38+
```
39+
40+
Your copied resources will need to include:
41+
- `host.json`, with your appsettings
42+
- `function_app.py`, such as:
43+
44+
```
45+
import arcgis
46+
import azure.functions as func
47+
48+
app = func.FunctionApp()
49+
50+
@app.http_trigger(route='GET /', methods=['get'])
51+
def main(req: func.HttpRequest) -> func.HttpResponse:
52+
return func.HttpResponse(f"Hello from Azure Functions using ArcGIS API for Python {arcgis.__version__}!")
53+
```
54+
55+
Push to the container registry of your choice.
56+
57+
For futher information, see:
58+
59+
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Capplication-level&pivots=python-mode-decorators#programming-model
60+
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-deploy-container-apps?tabs=acr%2Cbash&pivots=programming-language-python#create-and-test-the-local-functions-project
61+
- https://github.com/Azure/azure-functions-python-worker
62+
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-custom-container
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
local.settings.json
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
bin
2+
obj
3+
csx
4+
.vs
5+
edge
6+
Publish
7+
8+
*.user
9+
*.suo
10+
*.cscfg
11+
*.Cache
12+
project.lock.json
13+
14+
/packages
15+
/TestResults
16+
17+
/tools/NuGet.exe
18+
/App_Data
19+
/secrets
20+
/data
21+
.secrets
22+
appsettings.json
23+
local.settings.json
24+
25+
node_modules
26+
dist
27+
28+
# Local python packages
29+
.python_packages/
30+
31+
# Python Environments
32+
.env
33+
.venv
34+
env/
35+
venv/
36+
ENV/
37+
env.bak/
38+
venv.bak/
39+
40+
# Byte-compiled / optimized / DLL files
41+
__pycache__/
42+
*.py[cod]
43+
*$py.class
44+
45+
# Azurite artifacts
46+
__blobstorage__
47+
__queuestorage__
48+
__azurite_db*__.json
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-azuretools.vscode-azurefunctions"
4+
]
5+
}

0 commit comments

Comments
 (0)