Skip to content

Install project in Dockerfile so the access CLI is on PATH#439

Merged
somethingnew2-0 merged 1 commit into
mainfrom
pcollins/dockerfile-install-package
May 11, 2026
Merged

Install project in Dockerfile so the access CLI is on PATH#439
somethingnew2-0 merged 1 commit into
mainfrom
pcollins/dockerfile-install-package

Conversation

@somethingnew2-0
Copy link
Copy Markdown
Collaborator

@somethingnew2-0 somethingnew2-0 commented May 9, 2026

Summary

After the FastAPI migration in #425 the click-based CLI is declared in setup.py via:

entry_points={
    "console_scripts": ["access = api.manage:cli"],
}

but the production Dockerfile only runs pip install -r ./api/requirements.txt and never installs the project itself, so the access console script is never created at /usr/local/bin/access. As a result, the CronJob examples in examples/kubernetes/cron-job-*.yaml (which use command: ["access", "sync"] / ["access", "notify", ...]) fail at startup with StartError exit code 128 — the OCI runtime can't exec a binary that isn't on PATH.

This PR copies setup.py into the build context and runs pip install --no-deps . after the requirements install. --no-deps preserves the pinned versions in requirements.txt as the source of truth for runtime deps (the install_requires in setup.py uses looser constraints).

Test plan

  • docker build --target false -t access-test:local . succeeds locally; pip builds access-2.0-py3-none-any.whl from the in-tree setup.py and installs it cleanly with --no-deps.
  • In the resulting image, which access returns /usr/local/bin/access and access --help lists the full click command tree (fix-role-memberships, fix-unmanaged-groups, import-from-okta, init, init-builtin-apps, notify, sync, sync-app-group-memberships). Subcommand help (access sync --help, access notify --help) shows the expected flags including --sync-group-memberships-authoritatively, --owner, and --role-owner.
  • CMD is unchanged, so gunicorn ... api.asgi:app continues to launch the web app exactly as before.
  • One of the examples/kubernetes/cron-job-*.yaml CronJobs runs to completion against the rebuilt image (consumer-side verification; not exercised here).

The new click-based CLI is declared in setup.py via:

  entry_points = {
      'console_scripts': ['access = api.manage:cli'],
  }

but the Dockerfile only ran 'pip install -r requirements.txt' and never
installed the project itself, so '/usr/local/bin/access' was never
created. examples/kubernetes/cron-job-*.yaml use 'command: [access,
sync]' / 'command: [access, notify]' and would fail with 'StartError
exit code 128' (OCI runtime can't exec the missing binary).

Copy setup.py into the build context and 'pip install --no-deps .' so
the console script is installed. --no-deps preserves the pinned
versions from requirements.txt as the source of truth (setup.py uses
loose constraints).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@somethingnew2-0 somethingnew2-0 merged commit 3e9856e into main May 11, 2026
6 checks passed
@somethingnew2-0 somethingnew2-0 deleted the pcollins/dockerfile-install-package branch May 11, 2026 16:51
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.

2 participants