Skip to content

Commit 40b99d2

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

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

.github/workflows/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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=local-update-site
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
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
11+
jobs:
12+
build:
13+
name: Bundle extension and build image
14+
runs-on: ubuntu-latest
15+
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_build == 'true' }}
16+
env:
17+
LOCAL_UPDATE_SITE_DIR: local-update-site
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Pixi
23+
uses: prefix-dev/setup-pixi@v0.8.2
24+
25+
- name: Install environment
26+
run: pixi install
27+
28+
- name: Build local update site
29+
run: pixi run build
30+
31+
- name: Upload update site artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: extensionartifacts-for-update-site-${{ github.run_id }}
35+
path: ${{ env.LOCAL_UPDATE_SITE_DIR }}
36+
37+
- name: Compute KNIME feature group from knime.yml
38+
id: knime_meta
39+
shell: bash
40+
run: |
41+
pixi exec -- python - <<'PY'
42+
import os
43+
import yaml
44+
with open('knime.yml', 'r', encoding='utf-8') as f:
45+
y = yaml.safe_load(f)
46+
group_id = (y.get('group_id') or '').strip()
47+
name = (y.get('name') or '').strip()
48+
if not group_id or not name:
49+
raise SystemExit(f"Failed to parse group_id/name from knime.yml (group_id={group_id}, name={name})")
50+
feature_group_id = f"{group_id}.features.{name}.feature.group"
51+
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gh:
52+
print(f"feature_group_id={feature_group_id}", file=gh)
53+
print("Computed feature group:", feature_group_id)
54+
PY
55+
56+
- name: Build KNIME image with local update site
57+
run: |
58+
docker build \
59+
-f .github/workflows/Dockerfile \
60+
--build-arg LOCAL_UPDATE_SITE_SRC="${{ env.LOCAL_UPDATE_SITE_DIR }}" \
61+
--build-arg KNIME_FEATURES_ARG="${{ steps.knime_meta.outputs.feature_group_id }}" \
62+
-t knime-executor-with-extension:ci .

0 commit comments

Comments
 (0)