Skip to content

Commit be0bca1

Browse files
authored
Merge pull request #1687 from Esri/jtroe/notebook-docker
Add Notebook Docker Image and Build
2 parents d58e462 + dbf893a commit be0bca1

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: DockerBuild.NotebookImage
2+
3+
on:
4+
# allow it to be run on-demand
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-and-push:
9+
name: Build Docker image and push to ghcr.io
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
id: buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Login to Github Packages
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Docker meta
28+
id: meta
29+
uses: docker/metadata-action@v4
30+
with:
31+
images: |
32+
ghcr.io/esri/arcgis-python-api-notebook
33+
tags: |
34+
type=raw,value=2.3.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
38+
39+
- id: docker_build
40+
name: Build image and push to GitHub Container Registry
41+
uses: docker/build-push-action@v4
42+
with:
43+
# relative path to the place where source code with Dockerfile is located
44+
context: ./docker
45+
file: ./docker/NotebookImage.Dockerfile
46+
tags: ${{ steps.meta.outputs.tags }}
47+
provenance: false
48+
platforms: linux/amd64
49+
push: true

docker/NotebookImage.Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ARG python_version="3.9"
2+
FROM jupyter/base-notebook:python-${python_version}
3+
4+
ARG python_version
5+
ARG arcgis_version="2.2.0"
6+
ARG sampleslink="https://github.com/Esri/arcgis-python-api/releases/download/v${arcgis_version}/samples.zip"
7+
ARG githubfolder="arcgis-python-api"
8+
ENV DOCKER_STACKS_JUPYTER_CMD="notebook"
9+
10+
LABEL org.opencontainers.image.authors="[email protected]"
11+
LABEL org.opencontainers.image.description="Jupyter Notebook with the latest version of the ArcGIS API for Python and its Linux dependencies preinstalled"
12+
LABEL org.opencontainers.image.licenses=Apache
13+
LABEL org.opencontainers.image.source=https://github.com/Esri/arcgis-python-api
14+
15+
USER root
16+
17+
RUN apt-get update --yes && \
18+
apt-get install --yes --no-install-recommends unzip && \
19+
apt-get clean && rm -rf /var/lib/apt/lists/*
20+
21+
USER ${NB_UID}
22+
23+
# Install Python API from Conda
24+
RUN conda install -c esri arcgis=${arcgis_version} -y \
25+
&& conda clean --all -f -y \
26+
&& find /opt/conda -name __pycache__ -type d -exec rm -rf {} +
27+
28+
# Fetch and extract samples from GitHub
29+
RUN mkdir /home/${NB_USER}/$githubfolder && \
30+
wget -O samples.zip $sampleslink \
31+
&& unzip -q samples.zip -d /home/${NB_USER}/$githubfolder \
32+
&& rm samples.zip \
33+
&& mv /home/${NB_USER}/$githubfolder/* ./ \
34+
&& rm -rf $githubfolder/ \
35+
apidoc/ \
36+
work/ \
37+
talks/ \
38+
environment.yml\
39+
&& fix-permissions /home/${NB_USER}
40+
41+
RUN rm /opt/conda/lib/python${python_version}/site-packages/notebook/static/base/images/logo.png
42+
COPY --chown=${NB_USER}:users jupyter_esri_logo.png /opt/conda/lib/python${python_version}/site-packages/notebook/static/base/images/logo.png

docker/jupyter_esri_logo.png

6.78 KB
Loading

0 commit comments

Comments
 (0)