Skip to content

Commit c2a0029

Browse files
committed
Add Dockerfile and GitHub Actions workflow for KNIME extension build
1 parent af47399 commit c2a0029

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Define the base image
2+
FROM public.ecr.aws/i0n0z6j1/knime-full:5.6.0-nightly
3+
4+
# Path inside the image where the local update site will be copied
5+
ARG LOCAL_UPDATE_SITE_PATH=/home/knime/local-update-site
6+
ARG LOCAL_UPDATE_SITE_SRC
7+
ENV LOCAL_UPDATE_SITE_SRC=${LOCAL_UPDATE_SITE_SRC}
8+
9+
# Define the list of update sites and features
10+
# Add the local update site (copied into the image) to the list of update sites via file:// URL
11+
# Ensure the local update site is present in the build context under ./local-update-site
12+
ENV KNIME_UPDATE_SITES="file://${LOCAL_UPDATE_SITE_PATH}, https://update.knime.com/community-contributions/trusted/5.6, https://update.knime.com/analytics-platform/nightly/5.6.1"
13+
14+
# Install features from the update sites
15+
# Allow overriding via build-arg; fallback to a sensible default matching knime.yml (group_id + ".features." + name)
16+
ARG KNIME_FEATURES_ARG
17+
ENV KNIME_FEATURES="${KNIME_FEATURES_ARG:-org.tutorial.features.first_extension.feature.group}"
18+
19+
# Install CA Certificates
20+
USER root
21+
RUN apt-get update && \
22+
apt-get install -y ca-certificates chromium-browser && \
23+
update-ca-certificates && \
24+
rm -rf /var/lib/apt/lists/*
25+
26+
USER knime
27+
28+
# Copy the local update site produced by the build into the image so it's available during installation
29+
# The source folder can be overridden via --build-arg LOCAL_UPDATE_SITE_SRC=...
30+
COPY --chown=knime:knime ${LOCAL_UPDATE_SITE_SRC} ${LOCAL_UPDATE_SITE_PATH}
31+
32+
# Execute extension installation script
33+
RUN ./install-extensions.sh
34+
35+
# pre-start executor to improve startup time
36+
RUN KNIME_EXECUTOR_CONNECTION_RETRIES=0 knime/knime -data /home/knime/knime-workspace -consolelog -nosplash -application com.knime.enterprise.slave.KNIME_REMOTE_APPLICATION; rm -rf /home/knime/knime-workspace
37+
38+
# Copy the demo workflow into the image
39+
COPY --chown=knime:knime demo/Example_with_Python_node.knwf /home/knime/demo-workflow/
40+
41+
# Run the demo workflow to test the extension
42+
RUN knime/knime -data /home/knime/test-workspace -consolelog -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir=/home/knime/demo-workflow && rm -rf /home/knime/test-workspace
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 'Run KNIME Workflow Test'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
run_build:
7+
description: 'Run build job'
8+
required: false
9+
default: 'true'
10+
pull_request:
11+
types: [opened, synchronize, reopened]
12+
branches: [ master ]
13+
push:
14+
branches: [ master ]
15+
16+
jobs:
17+
build:
18+
name: Bundle extension and build image
19+
runs-on: ubuntu-latest
20+
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_build == 'true' }}
21+
env:
22+
LOCAL_UPDATE_SITE_DIR: local-update-site
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Pixi
28+
uses: prefix-dev/setup-pixi@v0
29+
30+
- name: Install environment
31+
run: pixi install
32+
33+
- name: Build local update site
34+
run: pixi run build
35+
36+
- name: Upload update site artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: extensionartifacts-for-update-site-${{ github.run_id }}
40+
path: ${{ env.LOCAL_UPDATE_SITE_DIR }}
41+
42+
- name: Compute KNIME feature group from knime.yml
43+
id: knime_meta
44+
shell: bash
45+
run: |
46+
pixi run -e build python - <<'PY'
47+
import os
48+
import yaml
49+
with open('knime.yml', 'r', encoding='utf-8') as f:
50+
y = yaml.safe_load(f)
51+
group_id = (y.get('group_id') or '').strip()
52+
name = (y.get('name') or '').strip()
53+
if not group_id or not name:
54+
raise SystemExit(f"Failed to parse group_id/name from knime.yml (group_id={group_id}, name={name})")
55+
feature_group_id = f"{group_id}.features.{name}.feature.group"
56+
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gh:
57+
print(f"feature_group_id={feature_group_id}", file=gh)
58+
print("Computed feature group:", feature_group_id)
59+
PY
60+
61+
- name: Build KNIME image with local update site
62+
run: |
63+
docker build \
64+
-f .github/workflows/Dockerfile \
65+
--build-arg LOCAL_UPDATE_SITE_SRC="${{ env.LOCAL_UPDATE_SITE_DIR }}" \
66+
--build-arg KNIME_FEATURES_ARG="${{ steps.knime_meta.outputs.feature_group_id }}" \
67+
-t knime-executor-with-extension:ci .

0 commit comments

Comments
 (0)