{"id":50786622,"url":"https://github.com/lincc-frameworks/ai-container","last_synced_at":"2026-06-12T08:03:17.166Z","repository":{"id":354506026,"uuid":"1223939836","full_name":"lincc-frameworks/ai-container","owner":"lincc-frameworks","description":"An apptainer for the USDF/s3df environment intended to contain a coding agent, prevent it from writing shared files or destroying data.","archived":false,"fork":false,"pushed_at":"2026-04-28T20:10:36.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-28T22:12:50.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lincc-frameworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-28T20:01:28.000Z","updated_at":"2026-04-28T20:10:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lincc-frameworks/ai-container","commit_stats":null,"previous_names":["lincc-frameworks/ai-container"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lincc-frameworks/ai-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincc-frameworks%2Fai-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincc-frameworks%2Fai-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincc-frameworks%2Fai-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincc-frameworks%2Fai-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lincc-frameworks","download_url":"https://codeload.github.com/lincc-frameworks/ai-container/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lincc-frameworks%2Fai-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34234558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-12T08:03:10.500Z","updated_at":"2026-06-12T08:03:17.160Z","avatar_url":"https://github.com/lincc-frameworks.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rubin AI Apptainer\n\nThis sub-project builds an Apptainer image intended for USDF/S3DF Rubin developers wanting to limit the actions taken by coding agents\n\n## Getting Started\n\n1. Clone the repo\n2. `make build` to create the container image and overlay fs\n3. `make shell` to enter a shell inside the container with latest shared pipelines loaded.\n4. Log into your coding agent. `claude`, `codex`, and `pi` are all pre-installed.\n\n## Claude-code specific instructions\nEnsure ~/.claude.json exists (`touch ~/.claude.json` is sufficient) prior to starting the container. This will persist logins in your real homedir across container sessions.\n\n## Design choices\n\n- **Fast shell entry**: image + tools are built ahead-of-time; runtime work is mostly bind mounts.\n- **LSST shared pipelines**: Loaded by default, configurable with LSST_STACK_VERSION and LSST_SETUP_PACKAGE. See `container-scripts/lsst_env_setup.sh`\n- **Persistent writable state**: a local writable Apptainer overlay (`build/overlay.img`) is used so package installs survive across sessions.\n- **Safety for shared Rubin state**: `/sdf/group/rubin` and `/sdf/data/rubin` are bind-mounted read-only.\n- **Home isolation by default**: launch script uses `--containall` and then bind mounts select paths (see list in `run.sh`)\n- **Coding Agent COnvenience**: coding agent settings and env vars are passed through vin bind mounts and en vars\n\n## Files\n\n- `Apptainer.def`: image build recipe.\n- `run.sh`: launcher with convigurable bind/env policy, called when you run `make shell`\n- `container-scripts/lsst_env_setup.sh`: local copy of the Rubin environment setup helper used at container startup.\n- `container-scripts/requirements.txt`: preloaded Python packages for the default Python 3.11 env.\n- `container-scripts/codex-oauth.sh`: browserless-oriented Codex OAuth helper.\n- `Makefile`: build/shell/rebuild helpers.\n\n## Build\n\n```bash\nmake build\n```\n\n## Enter shell\n\n```bash\nmake shell\n```\n\nFor debugging without entrypoint/LSST setup:\n\n```bash\nmake shell-raw\n```\n\n## Runtime behavior\n\nOn shell entry, the container sources `/opt/container/lsst_env_setup.sh` which:\n\n- loads LSST from `/sdf/group/rubin/sw/${LSST_STACK_VERSION}/loadLSST.sh`\n- runs `setup ${LSST_SETUP_PACKAGE}` (default: `lsst_distrib`)\n- exports Butler + Postgres credential env vars using `~/.lsst/*`\n\nFor correctness, `entrypoint.sh` currently uses the simple path and sources\n`/opt/container/lsst_env_setup.sh` on every container startup.\n\nInteractive shells use a Rubin-style prompt:\n\n`(env-name) [user@hostname-container] /path %`\n\nOverride defaults at launch:\n\n```bash\nBUTLER_STACK_VERSION=d_latest BUTLER_SETUP_PACKAGE=lsst_sitcom make shell\n```\n\n## Auth passthrough\n\nOnly selected vars are forwarded from host to container (add/remove in `runs.sh`):\n\n- `OPENAI_API_KEY`\n- `OPENAI_BASE_URL`\n- `ANTHROPIC_API_KEY`\n- `ANTHROPIC_BASE_URL`\n- `PI_PROVIDER`\n\nAuth/token directories are mounted when present:\n\n- `~/.codex` (RW)\n- `~/.claude` (RW)\n- `~/.claude.json` (RW)\n- `~/.pi` (RW)\n- `~/.lsst` (RO)\n\nAdditional bind policy in `scripts/run.sh`:\n\n- Host home directory is not mounted (`--containall`) to block writes via symlink traversal.\n- `~/rubin-user` is resolved to its canonical host path and then bound RW to `~/rubin-user` in-container.\n- Shared Rubin trees (`/sdf/group/rubin`, `/sdf/data/rubin`) remain mounted RO.\n- Mounts are organized as a three-tier policy in one place:\n  - Tier 1 (RW): user-owned work + agent/auth state (`~/rubin-user`, `~/.codex`, `~/.claude`, `~/.pi`).\n  - Tier 2 (RO): shared Rubin trees.\n  - Tier 3 (none): everything else is not mounted unless explicitly listed.\n- All Tier 1/Tier 2 bind entries go through the same conditional source-exists processing before being passed to `apptainer`.\n\n### Codex OAuth (browserless-friendly)\n\nInside the container, run:\n\n```bash\ncodex-oauth\n```\n\nThe helper attempts device-style login if available in the installed Codex CLI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flincc-frameworks%2Fai-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flincc-frameworks%2Fai-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flincc-frameworks%2Fai-container/lists"}