Build contributed recipes in PRs (#2212)

* Build contributed recipes in PRs

* Fix GitHub matrix
This commit is contained in:
Ayaz Salikhov
2025-02-17 15:25:44 +00:00
committed by GitHub
parent ae572aa64f
commit 102f5a6325
14 changed files with 60 additions and 24 deletions

View File

@@ -43,8 +43,17 @@ jobs:
- name: Checkout Repo ⚡️ - name: Checkout Repo ⚡️
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Load image to Docker 📥
if: ${{ github.event_name == 'workflow_call' && matrix.parent-image != '' }}
uses: ./.github/actions/load-image
with:
image: ${{ matrix.parent-image }}
platform: ${{ matrix.platform }}
variant: default
# Not pulling the image, because it might be loaded from previous step or will be downloaded automatically
- name: Build recipe 🛠 - name: Build recipe 🛠
run: docker build --pull --rm --force-rm --tag my-custom-image -f ./${{ matrix.dockerfile }} ./ run: docker build --rm --force-rm --tag my-custom-image -f ./${{ matrix.dockerfile }} ./
env: env:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
# Full logs for CI build # Full logs for CI build

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/minimal-notebook ARG BASE_IMAGE=quay.io/jupyter/minimal-notebook
FROM $BASE_IMAGE
# Name your environment and choose the Python version # Name your environment and choose the Python version
ARG env_name=python310 ARG env_name=python310

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
# Install the Dask dashboard # Install the Dask dashboard
RUN mamba install --yes 'dask-labextension' && \ RUN mamba install --yes 'dask-labextension' && \

View File

@@ -2,24 +2,39 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
import json import json
import os
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
THIS_DIR = Path(__file__).parent.resolve() THIS_DIR = Path(__file__).parent.resolve()
REPOSITORY_OWNER = os.environ["REPOSITORY_OWNER"]
def generate_matrix() -> dict[str, Any]: def generate_matrix() -> Any:
dockerfiles = sorted(file.name for file in THIS_DIR.glob("*.dockerfile")) dockerfiles = sorted(THIS_DIR.glob("*.dockerfile"))
runs_on = ["ubuntu-24.04", "ubuntu-22.04-arm"] runs_on = ["ubuntu-24.04", "ubuntu-22.04-arm"]
return {
"dockerfile": dockerfiles, configurations = []
"runs-on": runs_on, for dockerfile in dockerfiles:
"exclude": [ dockerfile_name = dockerfile.name
{"dockerfile": "oracledb.dockerfile", "runs-on": "ubuntu-22.04-arm"} for run in runs_on:
], if dockerfile_name == "oracledb.dockerfile" and run == "ubuntu-22.04-arm":
} continue
dockerfile_lines = dockerfile.read_text().splitlines()
base_image = [
line for line in dockerfile_lines if line.startswith("ARG BASE_IMAGE=")
][0][15:]
base_image_short = base_image[base_image.rfind("/") + 1 :]
# Handling a case of `docker.io/jupyter/base-notebook:notebook-6.5.4` image
if ":" in base_image_short:
base_image_short = ""
configurations.append(
{
"dockerfile": dockerfile_name,
"runs-on": run,
"platform": "x86_64" if run == "ubuntu-24.04" else "aarch64",
"parent-image": base_image_short,
}
)
return {"include": configurations}
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
USER root USER root

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
RUN mamba install --yes 'jupyterhub-singleuser==4.0.1' && \ RUN mamba install --yes 'jupyterhub-singleuser==4.0.1' && \
mamba clean --all -f -y && \ mamba clean --all -f -y && \

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
RUN mamba install --yes 'flake8' && \ RUN mamba install --yes 'flake8' && \
mamba clean --all -f -y && \ mamba clean --all -f -y && \

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006 # Fix: https://github.com/hadolint/hadolint/wiki/DL4006
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014 # Fix: https://github.com/koalaman/shellcheck/wiki/SC3014

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006 # Fix: https://github.com/hadolint/hadolint/wiki/DL4006
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014 # Fix: https://github.com/koalaman/shellcheck/wiki/SC3014

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
USER root USER root

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
# Install in the default python3 environment # Install in the default python3 environment
RUN pip install --no-cache-dir 'flake8' && \ RUN pip install --no-cache-dir 'flake8' && \

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
RUN mamba install --yes 'jupyterlab_rise' && \ RUN mamba install --yes 'jupyterlab_rise' && \
mamba clean --all -f -y && \ mamba clean --all -f -y && \

View File

@@ -1,5 +1,6 @@
# Using Docker Hub here, because this image is old and not pushed to Quay.io # Using Docker Hub here, because this image is old and not pushed to Quay.io
FROM docker.io/jupyter/base-notebook:notebook-6.5.4 ARG BASE_IMAGE=docker.io/jupyter/base-notebook:notebook-6.5.4
FROM $BASE_IMAGE
RUN pip install --no-cache-dir 'jupyter_contrib_nbextensions' && \ RUN pip install --no-cache-dir 'jupyter_contrib_nbextensions' && \
jupyter contrib nbextension install --user && \ jupyter contrib nbextension install --user && \

View File

@@ -1,4 +1,5 @@
FROM quay.io/jupyter/base-notebook ARG BASE_IMAGE=quay.io/jupyter/base-notebook
FROM $BASE_IMAGE
RUN mamba install --yes 'py-xgboost' && \ RUN mamba install --yes 'py-xgboost' && \
mamba clean --all -f -y && \ mamba clean --all -f -y && \