@@ -38,14 +38,29 @@ pip install -e .
3838### Build Your First Image
3939
4040``` bash
41- # From your Python project root
41+ # Simple build (auto-detects everything)
4242pycontainer build --tag myapp:latest
4343
44- # With custom context
45- pycontainer build --tag myapp:v1 --context /path/to/app
44+ # Build on a base image with dependencies
45+ pycontainer build \
46+ --tag myapp:v1 \
47+ --base-image python:3.11-slim \
48+ --include-deps
49+
50+ # Build FastAPI app (auto-detected, entrypoint configured)
51+ pycontainer build --tag api:latest --context ./my-fastapi-app
52+
53+ # Build with SBOM for security compliance
54+ pycontainer build \
55+ --tag myapp:v1 \
56+ --sbom spdx \
57+ --config pycontainer.toml
4658
4759# Build and push to registry
4860pycontainer build --tag ghcr.io/user/myapp:v1 --push
61+
62+ # Dry-run to preview (verbose mode)
63+ pycontainer build --tag test:latest --dry-run --verbose
4964```
5065
5166### Output
@@ -67,8 +82,9 @@ dist/image/
6782
6883## ✨ Features
6984
70- ### Current Capabilities (Phase 1 ✅)
85+ ### Current Capabilities (Phases 0-2, 4 ✅)
7186
87+ ** Foundation & Registry** (Phases 0-1):
7288- ✅ ** Zero Docker dependencies** — Pure Python implementation
7389- ✅ ** Auto-detects Python project structure** — Finds ` src/ ` , ` app/ ` , entry points
7490- ✅ ** Infers entrypoints** — Reads ` pyproject.toml ` scripts, falls back to ` python -m `
@@ -85,11 +101,26 @@ dist/image/
85101- ✅ ** Cache invalidation** — Detects file changes via mtime + size checks
86102- ✅ ** Fast incremental builds** — Reuses unchanged layers from cache
87103
104+ ** Base Images & Dependencies** (Phase 2):
105+ - ✅ ** Base image support** — Build on top of ` python:3.11-slim ` , distroless, etc.
106+ - ✅ ** Layer merging** — Combines base image layers with application layers
107+ - ✅ ** Config inheritance** — Merges env vars, labels, working dir from base images
108+ - ✅ ** Dependency packaging** — Include pip packages from venv or requirements.txt
109+ - ✅ ** Distroless detection** — Auto-handles shell-less base images
110+
111+ ** Production Features** (Phase 4):
112+ - ✅ ** Framework auto-detection** — FastAPI, Flask, Django automatically configured
113+ - ✅ ** Configuration files** — Load settings from ` pycontainer.toml `
114+ - ✅ ** SBOM generation** — Create SPDX 2.3 or CycloneDX 1.4 security manifests
115+ - ✅ ** Reproducible builds** — Deterministic layer creation with fixed timestamps
116+ - ✅ ** Platform configuration** — Target different architectures with ` --platform `
117+ - ✅ ** Verbose logging** — Detailed build progress with ` --verbose `
118+ - ✅ ** Dry-run mode** — Preview builds with ` --dry-run `
119+
88120### Coming Soon
89121
90- - 🔜 ** Base image layering** — Build on top of ` python:3.11-slim ` , distroless, etc. (Phase 2)
91- - 🔜 ** Dependency packaging** — Include pip-installed packages (Phase 2)
92- - 🔜 ** Multi-architecture builds** — ARM64, AMD64 support (Phase 4)
122+ - 🔜 ** Toolchain integrations** — Poetry, Hatch, Azure Developer CLI (Phase 3)
123+ - 🔜 ** Full multi-arch builds** — Actual cross-compilation for ARM64, AMD64 (Phase 4+)
93124
94125---
95126
@@ -157,21 +188,39 @@ By default, `pycontainer` auto-detects:
157188### Explicit Configuration
158189
159190``` bash
191+ # Full configuration with all options
160192pycontainer build \
161193 --tag myapp:v1.2.3 \
162194 --context /my/project \
195+ --base-image python:3.11-slim \
196+ --include-deps \
163197 --workdir /app \
164198 --env KEY=value \
165199 --env ANOTHER=value \
200+ --platform linux/amd64 \
201+ --sbom cyclonedx \
202+ --config pycontainer.toml \
203+ --verbose \
166204 --push \
167- --no-cache \
168- --cache-dir ~ /.mycache
205+ --no-cache
169206```
170207
208+ ** Base Image & Dependencies** :
209+ - ` --base-image IMAGE ` — Base image to build on (e.g., ` python:3.11-slim ` )
210+ - ` --include-deps ` — Package dependencies from venv or requirements.txt
211+
171212** Caching Options** :
172213- ` --no-cache ` — Disable layer caching, force full rebuild
173214- ` --cache-dir PATH ` — Custom cache directory (default: ` ~/.pycontainer/cache ` )
174215
216+ ** Production Features** :
217+ - ` --config FILE ` — Load settings from ` pycontainer.toml `
218+ - ` --sbom FORMAT ` — Generate SBOM (` spdx ` or ` cyclonedx ` )
219+ - ` --platform PLATFORM ` — Target platform (e.g., ` linux/arm64 ` )
220+ - ` --verbose ` / ` -v ` — Detailed build progress
221+ - ` --dry-run ` — Preview build without creating artifacts
222+ - ` --no-reproducible ` — Disable deterministic builds
223+
175224The cache automatically:
176225- Reuses unchanged layers across builds (content-addressable by SHA256)
177226- Invalidates on file content changes (mtime + size checks)
@@ -180,14 +229,48 @@ The cache automatically:
180229### Python API
181230
182231``` python
183- BuildConfig(
232+ from pycontainer.config import BuildConfig
233+ from pycontainer.builder import ImageBuilder
234+
235+ config = BuildConfig(
184236 tag = " myapp:latest" ,
185237 context_path = " ." ,
238+ base_image = " python:3.11-slim" ,
239+ include_deps = True ,
186240 workdir = " /app" ,
187- env = {" DEBUG" : " false" },
241+ env = {" DEBUG" : " false" , " ENV" : " production" },
242+ labels = {" version" : " 1.0" , " maintainer" : " team@example.com" },
188243 include_paths = [" src/" , " lib/" , " pyproject.toml" ],
189- entrypoint = [" python" , " -m" , " myapp" ]
244+ entrypoint = [" python" , " -m" , " myapp" ],
245+ generate_sbom = " spdx" ,
246+ reproducible = True ,
247+ verbose = True
190248)
249+
250+ builder = ImageBuilder(config)
251+ builder.build()
252+ ```
253+
254+ ### Configuration File (` pycontainer.toml ` )
255+
256+ ``` toml
257+ [build ]
258+ base_image = " python:3.11-slim"
259+ workdir = " /app"
260+ include_deps = true
261+ reproducible = true
262+
263+ [build .labels ]
264+ maintainer = " team@example.com"
265+ version = " 1.0.0"
266+
267+ [build .env ]
268+ PORT = " 8080"
269+ ENV = " production"
270+ DEBUG = " false"
271+
272+ [registry ]
273+ url = " ghcr.io/myorg/myapp"
191274```
192275
193276---
@@ -209,30 +292,30 @@ BuildConfig(
209292- [x] Add layer caching and reuse logic
210293- [x] Digest verification and content-addressable storage
211294
212- ### 📋 ** Phase 2: Base Images & Dependencies**
295+ ### ✅ ** Phase 2: Base Images & Dependencies** (COMPLETE)
213296
214- - [ ] Pull and parse base image manifests
215- - [ ] Layer Python app files on top of base images
216- - [ ] Support slim, distroless, and custom base images
217- - [ ] Package pip-installed dependencies into layers
218- - [ ] Respect base image configuration (env, labels, user)
297+ - [x ] Pull and parse base image manifests
298+ - [x ] Layer Python app files on top of base images
299+ - [x ] Support slim, distroless, and custom base images
300+ - [x ] Package pip-installed dependencies into layers
301+ - [x ] Respect base image configuration (env, labels, user)
219302
220- ### 📋 ** Phase 3: Toolchain Integrations**
303+ ### 📋 ** Phase 3: Toolchain Integrations** (Planned)
221304
222305- [ ] Poetry plugin (` poetry build --container ` )
223306- [ ] Hatch build hook
224307- [ ] Azure Developer CLI (azd) integration
225308- [ ] GitHub Actions reusable workflow
226309- [ ] VS Code extension / Copilot templates
227310
228- ### 📋 ** Phase 4: Polish & Production Readiness**
311+ ### ✅ ** Phase 4: Polish & Production Readiness** (COMPLETE)
229312
230- - [ ] Framework auto-detection (FastAPI, Flask, Django)
231- - [ ] ` pycontainer.toml ` configuration schema
232- - [ ] SBOM (Software Bill of Materials) generation
233- - [ ] Reproducible builds (deterministic layer creation)
234- - [ ] Multi-architecture support (ARM64 )
235- - [ ] Verbose logging and diagnostics
313+ - [x ] Framework auto-detection (FastAPI, Flask, Django)
314+ - [x ] ` pycontainer.toml ` configuration schema
315+ - [x ] SBOM (Software Bill of Materials) generation
316+ - [x ] Reproducible builds (deterministic layer creation)
317+ - [x] Platform configuration (metadata for multi-arch )
318+ - [x ] Verbose logging and diagnostics
236319
237320---
238321
@@ -275,13 +358,14 @@ Works in GitHub Codespaces, Dev Box, locked-down environments — anywhere Pytho
275358
276359---
277360
278- ## 🔬 Current Limitations (By Design)
361+ ## 🔬 Current Limitations
279362
280- These are intentional scope limitations for the current phase :
363+ Known limitations and future enhancements :
281364
282- - ** No base image support** — Only creates application layers (Phase 2)
283- - ** No dependency packaging** — Expects dependencies in context (Phase 2)
284- - ** Single architecture** — ` amd64/linux ` only (Phase 4)
365+ - ** Multi-arch builds** — Platform flag sets metadata only; no actual cross-compilation yet
366+ - ** Framework detection** — Supports FastAPI, Flask, Django only (easy to extend)
367+ - ** SBOM scope** — Python packages only; doesn't parse OS packages from base images
368+ - ** Toolchain integrations** — Poetry, Hatch, azd plugins planned for Phase 3
285369
286370---
287371
0 commit comments