diff --git a/.github/workflows/DockerBuild.NotebookImage.yaml b/.github/workflows/DockerBuild.NotebookImage.yaml index 9327c427b0..3568bfcaa9 100644 --- a/.github/workflows/DockerBuild.NotebookImage.yaml +++ b/.github/workflows/DockerBuild.NotebookImage.yaml @@ -11,15 +11,27 @@ on: version: description: "Version of ArcGIS API for Python to install in the image" type: string - default: "2.4.1" + default: "2.4.2" + arcgis_mapping_version: + description: "Version of arcgis-mapping to install in the image (only used if version >= 2.4.0)" + type: string + default: "4.33.0" python_version: description: "Python version to base image on" type: string - default: "3.11" + default: "3.13" is_latest_release: description: "Version of ArcGIS API for Python is Latest current release" type: boolean default: false + arcgis_wheel_url: + description: "Use a custom version of ArcGIS API for Python from this wheel URL, if empty, use pypi.org; if provided, `-prerelease` will be appended to the image tag" + type: string + default: "" + arcgis_mapping_wheel_url: + description: "Use a custom version of arcgis-mapping from this wheel URL, if empty, install from pypi.org; if provided, `-prerelease` will be appended to the image tag" + type: string + default: "" is_default_supported_python: description: "Python version is default supported version (i.e. python used by Pro and Enterprise)" type: boolean @@ -52,10 +64,10 @@ jobs: images: | ghcr.io/esri/arcgis-python-api-notebook tags: | - 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 }} + type=raw,value=${{ inputs.version }}-python${{ inputs.python_version }}${{ inputs.arcgis_wheel_url != '' && '-prerelease' || '' }} + type=raw,value=${{ inputs.version }},enable=${{ inputs.is_default_supported_python && inputs.arcgis_wheel_url == '' && github.ref_name == github.event.repository.default_branch }} + type=raw,value=latest,enable=${{ inputs.arcgis_wheel_url == '' && 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.arcgis_wheel_url == '' && 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 @@ -67,6 +79,9 @@ jobs: build-args: | python_version=${{ inputs.python_version }} arcgis_version=${{ inputs.version }} + arcgis_mapping_version=${{ inputs.arcgis_mapping_version }} + arcgis_wheel_url=${{ inputs.arcgis_wheel_url }} + arcgis_mapping_wheel_url=${{ inputs.arcgis_mapping_wheel_url }} tags: ${{ steps.meta.outputs.tags }} provenance: false platforms: linux/amd64 diff --git a/docker/NotebookImage.Dockerfile b/docker/NotebookImage.Dockerfile index d523b355d1..1558c01c29 100644 --- a/docker/NotebookImage.Dockerfile +++ b/docker/NotebookImage.Dockerfile @@ -1,9 +1,14 @@ -ARG python_version="3.11" +ARG python_version="3.13" FROM quay.io/jupyter/minimal-notebook:python-${python_version} ARG python_version -ARG arcgis_version="2.4.1" -ARG gdal_version="3.10.2" +ARG arcgis_version="2.4.2" +ARG arcgis_mapping_version="4.33.0" +ARG gdal_version="3.11.4" +# If arcgis_wheel_url is provided, the Dockerfile will attempt to install the ArcGIS API for Python from that URL +ARG arcgis_wheel_url="" +ARG arcgis_mapping_wheel_url="" + ARG sampleslink="https://github.com/Esri/arcgis-python-api/releases/download/v${arcgis_version}/samples.zip" ARG githubfolder="arcgis-python-api" ARG env_name=arcgis @@ -25,17 +30,20 @@ RUN conda install -n ${env_name} -c conda-forge gdal=${gdal_version} -y --quiet && conda clean --all -f -y \ && find /opt/conda -name __pycache__ -type d -exec rm -rf {} + +RUN echo "${arcgis_wheel_url:-arcgis==${arcgis_version}.*}" > /tmp/arcgis_source.txt + # Install ArcGIS API for Python from pypi RUN . activate ${env_name} \ - # adding .* ensures the latest patch version is installed - && python -m pip install "arcgis==${arcgis_version}.*" \ + && python -m pip install "$(cat /tmp/arcgis_source.txt)" \ && conda clean --all -f -y \ && find /opt/conda -name __pycache__ -type d -exec rm -rf {} + +RUN echo "${arcgis_mapping_wheel_url:-arcgis-mapping==${arcgis_mapping_version}.*}" > /tmp/arcgis_mapping_source.txt + # Install arcgis-mapping if arcgis_version >= 2.4.0 RUN (dpkg --compare-versions $arcgis_version ge 2.4.0 \ && . activate ${env_name} \ - && python -m pip install arcgis-mapping \ + && python -m pip install "$(cat /tmp/arcgis_mapping_source.txt)" \ && conda clean --all -f -y \ && find /opt/conda -name __pycache__ -type d -exec rm -rf {} +;) \ || echo "[INFO] Skipped installing arcgis-mapping for version $arcgis_version (>= 2.4.0 required for arcgis-mapping)"