Skip to content

feat(ci): Add bentoctl Dockerfile and build/publish workflow - #360

Open
nehan-p wants to merge 10 commits into
mainfrom
359-ci-publish-bentoctl-as-a-docker-image
Open

feat(ci): Add bentoctl Dockerfile and build/publish workflow#360
nehan-p wants to merge 10 commits into
mainfrom
359-ci-publish-bentoctl-as-a-docker-image

Conversation

@nehan-p

@nehan-p nehan-p commented Jul 21, 2026

Copy link
Copy Markdown

Adds a Dockerfile and GitHub Actions workflow to build and publish bentoctl as a Docker image, so it can be used as a k8s Job image to run bentoctl init-auth for Keycloak initialization.

  • Adds Dockerfile: Python 3.14 base image, installs the Docker CLI and compose plugin via Docker's official apt repo (Debian's docker.io package doesn't ship a client binary), copies in lib/ and the compose files since config.py runs docker compose config at import time, sets up a venv, and creates a bentoctl shell alias
  • Adds dev.Dockerfile: mirrors Dockerfile minus the py_bentoctl source copy, since dev images should have dependencies pre-built with the source mounted in as a volume for local iteration
  • Adds .github/workflows/build.yml: builds and smoke-tests both the main and dev images, then publishes to ghcr.io/bento-platform/bentoctl via bento_build_action on pushes/PRs to main and published releases
  • Fixes init-auth's hard dependency on a Docker daemon (fix(bentoctl): init-auth external provider #361): docker_client is now optional in auth_helper.py, entry.py only builds a Docker client when BENTOV2_USE_EXTERNAL_IDP is false, and a new BENTOV2_AUTH_CREATE_TEST_USER env var allows test user creation to be forced on for external IdPs
  • Fixes a second Docker Compose dependency in config.py: service enumeration via docker compose config ran unconditionally at import time and crashed without a full local Compose environment. Adds a new BENTO_PLATFORM env var (docker/kubernetes) to skip this when not running under Docker Compose

Testing: Built and ran both images locally, confirming the smoke test passes with exit code 0 for each. Also rebuilt the image with the init-auth fixes and confirmed bentoctl init-auth no longer crashes on docker.from_env() or docker compose config when run with BENTOV2_USE_EXTERNAL_IDP=true and BENTO_PLATFORM=kubernetes — it proceeds into the real Keycloak auth flow and successfully reaches the point of making an authenticated request against a live Keycloak instance.

Closes #359
Closes #361

@nehan-p
nehan-p requested a review from v-rocheleau July 21, 2026 16:57
@nehan-p nehan-p self-assigned this Jul 21, 2026
@nehan-p nehan-p linked an issue Jul 21, 2026 that may be closed by this pull request

@v-rocheleau v-rocheleau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small request, otherwise looks good!

Comment thread dev.Dockerfile Outdated
Comment thread .github/workflows/build.yml
Comment thread .github/workflows/build.yml
Comment thread py_bentoctl/auth_helper.py Outdated
Comment thread py_bentoctl/auth_helper.py Outdated
Comment thread py_bentoctl/auth_helper.py Outdated

@v-rocheleau v-rocheleau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 small change, otherwise lgtm!

Comment thread py_bentoctl/entry.py Outdated
@v-rocheleau

Copy link
Copy Markdown
Contributor

LGTM! Nice work

Not approving right now just because I want to wait before merging to see if we ship this with the next release.
We'll discuss that at the brainstorm meeting tomorrow!

@v-rocheleau v-rocheleau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change request.

Testing the full pipeline now with published bentoctl images

Comment thread py_bentoctl/entry.py Outdated

@v-rocheleau v-rocheleau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a flash

Comment thread py_bentoctl/auth_helper.py Outdated
if e.status != 404:
raise
k8s_client.create_namespaced_secret(
namespace="default",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request: just realised, we need a way to specify the namespace for secrets creation via an env variable.

We can default to "default" for dev use cases, but in prod clusters the services will not be deployed in the default namespace. The ServiceAccount, ClusterRole, etc will need to be adapted to that namespace as well in a prod cluster.

I suggest we use this env var BENTO_K8S_NAMESPACE for this and use this value here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(bentoctl): init-auth external provider CI: publish bentoctl as a Docker image

2 participants