Repository navigation
feat: container-aware setup-environment with lean container variant - #17
Conversation
- Add container detection via /etc/quantecon-container marker file - In container mode: only install delta packages via conda env update - In standard mode: full installation (backwards compatible) - Add new outputs: container-mode, conda-cache-hit - Update Dockerfile to create marker file during build - Update all documentation to reflect new behavior Performance improvement: - Container mode: ~1-2 min setup (vs ~8-10 min standard) - Auto-detects environment, no workflow changes needed
- Skip environment processing entirely when environment-file is empty - Use direct pip install for faster package installation - Avoid slow conda env update --prune - Add 'Container (Pure)' test for fastest path
- Parse environment.yml for both conda and pip dependencies - Install conda packages with 'conda install -y -q' - Install pip packages with 'pip install --quiet' - Skip 'pip' itself as a dependency
The --prune flag causes a full environment solve which is slow. Without --prune, conda env update just adds missing packages.
Two container variants: - quantecon (full): ~8GB with Anaconda 2025.12 + full TexLive - quantecon-build (lean): ~3GB with explicit packages + minimal TexLive The lean container includes superset of packages used across: - lecture-python-intro - lecture-python.myst - lecture-python-advanced.myst - lecture-python-programming.myst Lecture-specific packages (quantecon, wbgapi, jax, etc.) are installed from each lecture's environment.yml at build time. Also: - Updated build workflow to build both containers - Updated test workflow to test both containers - Added containers/README.md documenting the variants
- Document both quantecon (full) and quantecon-build (lean) containers - Add examples for container mode with/without environment.yml - Add example for standard mode (no container) with full environment.yml - Clarify that standard mode continues to work for custom environments
There was a problem hiding this comment.
Pull request overview
Adds container-aware behavior to the setup-environment composite action and introduces a new lean quantecon-build container image to speed up CI by reducing image size and redundant installs.
Changes:
- Updated
setup-environmentto detect QuantEcon containers via/etc/quantecon-containerand follow a fast-path install strategy. - Added new
containers/quantecon-build(lean image) alongside updates to the existing fullquanteconcontainer for marker-based detection. - Expanded build/test workflows and documentation to cover both container variants and the new action outputs.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| setup-environment/action.yml | Adds container detection, container-mode caching/install logic, new outputs, and summary reporting. |
| setup-environment/README.md | Rewritten docs describing container vs standard mode usage, cache strategy, and outputs. |
| docs/QUICK-REFERENCE.md | Adds recommended container-based CI workflow and updated cache key guidance. |
| containers/quantecon/environment.yml | Clarifies “full” container intent and Anaconda metapackage usage. |
| containers/quantecon/Dockerfile | Adds /etc/quantecon-container marker for action auto-detection. |
| containers/quantecon-build/environment.yml | New lean conda environment spec for build-focused container. |
| containers/quantecon-build/Dockerfile | New lean container build with Miniconda + minimal TeXLive + marker file. |
| containers/quantecon-build/README.md | New documentation for lean container usage and comparison. |
| containers/README.md | New container comparison/selection guide and detection description. |
| .github/workflows/build-containers.yml | Builds and pushes both images; adds workflow_dispatch input to select images. |
| .github/workflows/test-container.yml | Tests both images with HTML/PDF/XeLaTeX checks and artifact upload. |
| README.md | Updates top-level usage examples to highlight container-based setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix build-containers.yml job conditions for push/schedule events
- Fix test-container.yml ls paths after cd commands
- Pin Miniconda version with SHA256 checksum for supply-chain security
- Improve setup-environment summary to show actual container image
- Add error exit when environment file specified but missing
- Restore bash -l {0} for ML libs to ensure conda activation
- Cache full conda env prefix instead of just site-packages
- Only run conda env update on cache miss to avoid inconsistent state
- Handle 'no environment file' case in summary output
Note: Keeping @main references for now; will update to @v1 at release time.
Review Feedback Addressed ✅Thanks for the thorough review! I've addressed all comments: Fixed
Note on
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove container mode caching (actions/cache runs on host, not in container)
- Update docs to reflect no caching in container mode
- Fix conda-cache-hit output description
- Use bash -l {0} for Display Environment Info step
- Change chmod 777 to chmod 755 for fontconfig cache (security)
- Update cache key documentation to match implementation
Created issue #18 to track future caching improvements.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove full container size comparison (not pulled in lean job) - Remove asterisk from 'No caching' in cache table (no footnote) - Clarify caching comment: conda env paths outside workspace mount - Update README: remove mention of caching in container mode
GitHub Copilot automatically reads instructions from .github/copilot-instructions.md
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove -n flag from conda env update to use env name from file (works regardless of environment-name input, more flexible) - Use plain bash instead of login shell for Display Environment Info (avoids PATH reset in containers where /etc/profile drops conda)
- Create separate test-xelatex.tex for quantecon-build using FreeSerif (lean container has FreeFont, not DejaVu) - Update test-container.yml to use correct test paths - Fix artifact upload path for lean container tests
- Add fonts-dejavu to quantecon-build Dockerfile (same as full container) - Both containers now use the same test file (containers/quantecon/tests/) - Remove separate test file that was created for lean container
Version py313_25.1.1-2 does not exist on Anaconda servers. Updated to latest available Python 3.13 Miniconda (December 2025).
- Lean container (quantecon-build) - Container-aware setup-environment - Container test workflow - DejaVu font fixes
Summary
Makes
setup-environmentautomatically detect when running inside QuantEcon containers and optimize accordingly. Also introduces a new lean container (quantecon-build) that is ~60% smaller for faster CI builds.Changes
New: Lean Container (
quantecon-build)ghcr.io/quantecon/quantecon-build:latestsetup-environment/action.yml/etc/quantecon-containermarker, runsconda env updatefor delta packages onlycontainer-mode,conda-cache-hitContainer Dockerfiles
/etc/quantecon-containerquantecon): Added marker + documented Anaconda metapackagequantecon-build): New Dockerfile with minimal TexLiveBuild Infrastructure
.github/workflows/build-containers.yml: Builds both containers,workflow_dispatchinput to select container.github/workflows/test-container.yml: Tests both containers after buildDocumentation Updates
README.md: Added container examplessetup-environment/README.md: Full rewrite with container mode docsdocs/QUICK-REFERENCE.md: Updated quick startcontainers/README.md: New container comparison guidePerformance Results
quantecon)quantecon-build)Container Comparison
Usage
Recommended: Lean Container for CI
Standard Mode (No Container)
Testing
Files Changed
containers/quantecon/Dockerfile- Added marker filecontainers/quantecon-build/- NEW lean containercontainers/README.md- NEW comparison guidesetup-environment/action.yml- Container-aware rewritesetup-environment/README.md- Updated docs.github/workflows/build-containers.yml- Builds both containers.github/workflows/test-container.yml- Tests both containersREADME.md,docs/QUICK-REFERENCE.md- Updated examples