containerforge 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- containerforge-2.1.1/LICENSE +17 -0
- containerforge-2.1.1/PKG-INFO +360 -0
- containerforge-2.1.1/README.md +315 -0
- containerforge-2.1.1/containerforge/__init__.py +12 -0
- containerforge-2.1.1/containerforge/analyzer/__init__.py +0 -0
- containerforge-2.1.1/containerforge/analyzer/app_analyzer.py +234 -0
- containerforge-2.1.1/containerforge/analyzer/detection_report.py +75 -0
- containerforge-2.1.1/containerforge/analyzer/source_detector.py +772 -0
- containerforge-2.1.1/containerforge/cicd/__init__.py +0 -0
- containerforge-2.1.1/containerforge/cicd/pipeline_gen.py +531 -0
- containerforge-2.1.1/containerforge/cli.py +792 -0
- containerforge-2.1.1/containerforge/cloud/__init__.py +0 -0
- containerforge-2.1.1/containerforge/cloud/cloud_deployer.py +555 -0
- containerforge-2.1.1/containerforge/cloud/llm_analyzer.py +218 -0
- containerforge-2.1.1/containerforge/config_loader.py +241 -0
- containerforge-2.1.1/containerforge/generator/__init__.py +0 -0
- containerforge-2.1.1/containerforge/generator/compose_gen.py +143 -0
- containerforge-2.1.1/containerforge/generator/db_wirer.py +298 -0
- containerforge-2.1.1/containerforge/generator/dockerfile_gen.py +218 -0
- containerforge-2.1.1/containerforge/generator/oci_dockerfile_gen.py +677 -0
- containerforge-2.1.1/containerforge/generator/sidecar_gen.py +399 -0
- containerforge-2.1.1/containerforge/grafana/__init__.py +0 -0
- containerforge-2.1.1/containerforge/grafana/dashboard_gen.py +317 -0
- containerforge-2.1.1/containerforge/injector/__init__.py +0 -0
- containerforge-2.1.1/containerforge/injector/health_injector.py +298 -0
- containerforge-2.1.1/containerforge/k8s/__init__.py +0 -0
- containerforge-2.1.1/containerforge/k8s/k8s_gen.py +467 -0
- containerforge-2.1.1/containerforge/sbom/__init__.py +0 -0
- containerforge-2.1.1/containerforge/scanner/__init__.py +0 -0
- containerforge-2.1.1/containerforge/scanner/vuln_scanner.py +262 -0
- containerforge-2.1.1/containerforge.egg-info/PKG-INFO +360 -0
- containerforge-2.1.1/containerforge.egg-info/SOURCES.txt +38 -0
- containerforge-2.1.1/containerforge.egg-info/dependency_links.txt +1 -0
- containerforge-2.1.1/containerforge.egg-info/entry_points.txt +3 -0
- containerforge-2.1.1/containerforge.egg-info/requires.txt +20 -0
- containerforge-2.1.1/containerforge.egg-info/top_level.txt +1 -0
- containerforge-2.1.1/pyproject.toml +90 -0
- containerforge-2.1.1/setup.cfg +4 -0
- containerforge-2.1.1/setup.py +3 -0
- containerforge-2.1.1/tests/test_all.py +1021 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2024 ContainerForge Contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: containerforge
|
|
3
|
+
Version: 2.1.1
|
|
4
|
+
Summary: Containerize anything. Ship everywhere. OCI-compliant, multi-language, batteries included.
|
|
5
|
+
Author: ContainerForge Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/containerforge/containerforge
|
|
8
|
+
Project-URL: Documentation, https://containerforge.dev
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/containerforge/containerforge/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/containerforge/containerforge/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: docker,kubernetes,containerization,oci,devops,cicd,cloud-native
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
22
|
+
Classifier: Topic :: System :: Software Distribution
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: click>=8.1
|
|
29
|
+
Requires-Dist: rich>=13.0
|
|
30
|
+
Requires-Dist: pyyaml>=6.0
|
|
31
|
+
Provides-Extra: docker
|
|
32
|
+
Requires-Dist: docker>=7.0; extra == "docker"
|
|
33
|
+
Provides-Extra: ai
|
|
34
|
+
Requires-Dist: anthropic>=0.25; extra == "ai"
|
|
35
|
+
Provides-Extra: all
|
|
36
|
+
Requires-Dist: docker>=7.0; extra == "all"
|
|
37
|
+
Requires-Dist: anthropic>=0.25; extra == "all"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
42
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
43
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
██████╗ ██████╗ ███╗ ██╗████████╗ █████╗ ██╗███╗ ██╗███████╗██████╗ ██████╗ ███████╗
|
|
50
|
+
██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔══██╗██║████╗ ██║██╔════╝██╔══██╗██╔════╝ ██╔════╝
|
|
51
|
+
██║ ██║ ██║██╔██╗██║ ██║ ███████║██║██╔██╗██║█████╗ ██████╔╝██║ ███╗█████╗
|
|
52
|
+
██║ ██║ ██║██║╚████║ ██║ ██╔══██║██║██║╚████║██╔══╝ ██╔══██╗██║ ██║██╔══╝
|
|
53
|
+
╚██████╗╚██████╔╝██║ ╚███║ ██║ ██║ ██║██║██║ ╚███║███████╗██║ ██║╚██████╔╝███████╗
|
|
54
|
+
╚═════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚══╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Containerize anything. Ship everywhere.**
|
|
58
|
+
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
[](https://python.org)
|
|
61
|
+
[](CHANGELOG.md)
|
|
62
|
+
[](CONTRIBUTING.md)
|
|
63
|
+
|
|
64
|
+
[Installation](#installation) · [Quick Start](#quick-start) · [Commands](#commands) · [Config](#configuration) · [Contributing](#contributing)
|
|
65
|
+
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
ContainerForge detects your app's language and framework, generates an OCI-compliant multi-stage Dockerfile, wires up databases, adds a self-healing sidecar with Prometheus metrics, and ships Kubernetes manifests and CI/CD pipelines — all from a single command.
|
|
71
|
+
|
|
72
|
+
## What it does
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
containerforge build ./my-api
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
That one command:
|
|
79
|
+
|
|
80
|
+
1. **Detects** language + framework (Python/Node/Go/Java/Ruby/Rust/PHP/.NET, 40+ frameworks)
|
|
81
|
+
2. **Generates** an OCI-compliant multi-stage Dockerfile (distroless for Go/Rust, slim for everything else)
|
|
82
|
+
3. **Injects** `/health` and `/telemetry` endpoints (Python apps, zero code changes)
|
|
83
|
+
4. **Wires** detected databases (postgres, mysql, redis, mongo, elastic, kafka, rabbitmq) into docker-compose
|
|
84
|
+
5. **Deploys** a sidecar watchdog that auto-restarts failed containers and exports Prometheus metrics
|
|
85
|
+
6. **Scans** the built image with Trivy for CVEs before you push
|
|
86
|
+
7. **Builds** and launches everything with `docker compose up -d`
|
|
87
|
+
|
|
88
|
+
Optional flags unlock more:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
containerforge build ./my-api --with-k8s --with-cicd --with-dash --push docker.io/myorg
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install containerforge
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or install from source:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git clone https://github.com/containerforge/containerforge
|
|
104
|
+
cd containerforge
|
|
105
|
+
pip install -e .
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Optional dependencies:**
|
|
109
|
+
|
|
110
|
+
| Feature | Requirement |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Vulnerability scanning | [Trivy](https://aquasecurity.github.io/trivy/) |
|
|
113
|
+
| AI analysis | `ANTHROPIC_API_KEY` environment variable |
|
|
114
|
+
| Cloud deploy | `aws`/`gcloud`/`az`/`fly` CLIs |
|
|
115
|
+
| Kubernetes | `kubectl` |
|
|
116
|
+
|
|
117
|
+
## Quick Start
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Detect what you have
|
|
121
|
+
containerforge detect ./my-app
|
|
122
|
+
|
|
123
|
+
# Generate all files + build + run
|
|
124
|
+
containerforge build ./my-app
|
|
125
|
+
|
|
126
|
+
# Generate files only (no docker build)
|
|
127
|
+
containerforge build ./my-app --no-build
|
|
128
|
+
|
|
129
|
+
# Full pipeline: k8s + CI/CD + Grafana + push
|
|
130
|
+
containerforge build ./my-app \
|
|
131
|
+
--with-k8s --with-cicd --with-dash \
|
|
132
|
+
--push docker.io/myorg
|
|
133
|
+
|
|
134
|
+
# Write a containerforge.yml to commit to version control
|
|
135
|
+
containerforge init ./my-app
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Commands
|
|
139
|
+
|
|
140
|
+
| Command | Description |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `build` | Detect + containerize + build + run |
|
|
143
|
+
| `detect` | Scan source dir, report language/framework/OCI metadata |
|
|
144
|
+
| `init` | Write a starter `containerforge.yml` |
|
|
145
|
+
| `scan` | Run Trivy vulnerability scan |
|
|
146
|
+
| `k8s` | Generate Kubernetes manifests |
|
|
147
|
+
| `cicd` | Generate CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins) |
|
|
148
|
+
| `deploy` | Deploy to cloud (aws / gcp / azure / fly) |
|
|
149
|
+
| `dashboard` | Generate Grafana dashboard + Prometheus config |
|
|
150
|
+
| `analyze` | AI-powered containerization quality analysis |
|
|
151
|
+
| `clean` | Remove all generated files |
|
|
152
|
+
| `list-supported` | Show all supported languages, frameworks, clouds |
|
|
153
|
+
|
|
154
|
+
### `build`
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
containerforge build ./my-app [OPTIONS]
|
|
158
|
+
|
|
159
|
+
Options:
|
|
160
|
+
-n, --name TEXT Image/service name (default: directory name)
|
|
161
|
+
-p, --port INT Override detected port
|
|
162
|
+
-t, --tag TEXT Docker image tag (default: latest)
|
|
163
|
+
-l, --lang TEXT Override language detection
|
|
164
|
+
-f, --framework TEXT Override framework detection
|
|
165
|
+
--platform TEXT OCI target platform (default: linux/amd64)
|
|
166
|
+
--no-inject Skip /health endpoint injection
|
|
167
|
+
--no-scan Skip Trivy scan
|
|
168
|
+
--no-build Generate files only
|
|
169
|
+
--no-run Build image but skip compose up
|
|
170
|
+
--with-k8s Also generate Kubernetes manifests
|
|
171
|
+
--with-cicd Also generate CI/CD pipelines
|
|
172
|
+
--with-dash Also generate Grafana dashboard
|
|
173
|
+
--push TEXT Push to registry after build
|
|
174
|
+
--ai Run LLM analysis (requires ANTHROPIC_API_KEY)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### `k8s`
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
containerforge k8s ./my-app --namespace production --replicas 3 --ingress --hpa
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Generates `k8s/` with:
|
|
184
|
+
- `00-namespace.yaml` — Namespace
|
|
185
|
+
- `01-serviceaccount.yaml` — ServiceAccount (no token automount)
|
|
186
|
+
- `02-configmap.yaml` — Non-sensitive env vars
|
|
187
|
+
- `03-secret.yaml` — Secret template (never commit real values)
|
|
188
|
+
- `04-deployment.yaml` — Deployment with liveness/readiness/startup probes, resource limits, anti-affinity, seccomp
|
|
189
|
+
- `05-service.yaml` — ClusterIP Service
|
|
190
|
+
- `06-networkpolicy.yaml` — Deny-all NetworkPolicy with explicit allowances
|
|
191
|
+
- `07-pdb.yaml` — PodDisruptionBudget (minAvailable: 1)
|
|
192
|
+
- `08-ingress.yaml` — Ingress with cert-manager TLS (optional)
|
|
193
|
+
- `09-hpa.yaml` — HorizontalPodAutoscaler (optional)
|
|
194
|
+
- `kustomization.yaml` — Kustomize entry point
|
|
195
|
+
|
|
196
|
+
### `cicd`
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
containerforge cicd ./my-app --provider github
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Generates pipelines with stages: **test → build → scan (Trivy/SARIF) → push → deploy**
|
|
203
|
+
|
|
204
|
+
- **GitHub Actions** — `.github/workflows/containerforge.yml`
|
|
205
|
+
- Uploads Trivy results to GitHub Security tab
|
|
206
|
+
- Generates + uploads SBOM artifact
|
|
207
|
+
- Multi-platform builds (amd64 + arm64) on push to main
|
|
208
|
+
- **GitLab CI** — `.gitlab-ci.yml`
|
|
209
|
+
- Container scanning report
|
|
210
|
+
- Manual deploy gate to production
|
|
211
|
+
- **Jenkins** — `Jenkinsfile` (declarative pipeline)
|
|
212
|
+
|
|
213
|
+
### `deploy`
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
containerforge deploy ./my-app --provider aws --region us-east-1
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
| Provider | Service | IaC |
|
|
220
|
+
|---|---|---|
|
|
221
|
+
| `aws` | ECS Fargate | CloudFormation + deploy script |
|
|
222
|
+
| `gcp` | Cloud Run | Cloud Run YAML + deploy script |
|
|
223
|
+
| `azure` | Container Apps | Bicep + deploy script |
|
|
224
|
+
| `fly` | Fly.io Machines | fly.toml + deploy script |
|
|
225
|
+
|
|
226
|
+
Use `--gen-only` to write IaC files without executing the deploy.
|
|
227
|
+
|
|
228
|
+
### `analyze`
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
232
|
+
containerforge analyze ./my-app
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Uses Claude to review your Dockerfile and source code. Returns:
|
|
236
|
+
- Production readiness score (0–100) with breakdown by category
|
|
237
|
+
- Security issues (hardcoded secrets, non-root user, missing caps)
|
|
238
|
+
- Dockerfile optimizations (layer caching, image size, multi-stage)
|
|
239
|
+
- Top 5 ranked recommendations with code snippets
|
|
240
|
+
|
|
241
|
+
## Configuration
|
|
242
|
+
|
|
243
|
+
Create `containerforge.yml` in your app directory (or run `containerforge init ./my-app`):
|
|
244
|
+
|
|
245
|
+
```yaml
|
|
246
|
+
# containerforge.yml — commit this to version control
|
|
247
|
+
name: my-api
|
|
248
|
+
lang: python
|
|
249
|
+
framework: flask
|
|
250
|
+
port: 5000
|
|
251
|
+
tag: latest
|
|
252
|
+
platform: linux/amd64
|
|
253
|
+
|
|
254
|
+
# Observability
|
|
255
|
+
sidecar_port: 9090
|
|
256
|
+
inject_health: true
|
|
257
|
+
|
|
258
|
+
# Security
|
|
259
|
+
scan: true
|
|
260
|
+
sbom: false
|
|
261
|
+
|
|
262
|
+
# Databases (auto-detected, or specify explicitly)
|
|
263
|
+
databases:
|
|
264
|
+
- postgres
|
|
265
|
+
- redis
|
|
266
|
+
|
|
267
|
+
# Secrets to expose as env vars
|
|
268
|
+
env_secrets:
|
|
269
|
+
- DATABASE_URL
|
|
270
|
+
- SECRET_KEY
|
|
271
|
+
|
|
272
|
+
# Registry
|
|
273
|
+
push_registry: docker.io/myorg
|
|
274
|
+
|
|
275
|
+
# Kubernetes
|
|
276
|
+
k8s:
|
|
277
|
+
namespace: production
|
|
278
|
+
replicas: 3
|
|
279
|
+
ingress: true
|
|
280
|
+
ingress_host: api.example.com
|
|
281
|
+
hpa: true
|
|
282
|
+
min_replicas: 2
|
|
283
|
+
max_replicas: 20
|
|
284
|
+
|
|
285
|
+
# Cloud deploy
|
|
286
|
+
cloud:
|
|
287
|
+
provider: aws
|
|
288
|
+
region: us-east-1
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
CLI flags always override `containerforge.yml` values.
|
|
292
|
+
|
|
293
|
+
## Supported Languages & Frameworks
|
|
294
|
+
|
|
295
|
+
| Language | Frameworks | Runtime Image |
|
|
296
|
+
|---|---|---|
|
|
297
|
+
| Python | Flask, FastAPI, Django, Starlette, Tornado, aiohttp, Sanic, Bottle, Litestar | python:3.x-slim |
|
|
298
|
+
| Node.js | Express, Fastify, Next.js, NestJS, Koa, Hapi, Nuxt | node:20-alpine |
|
|
299
|
+
| Go | Gin, Echo, Fiber, Chi, Gorilla Mux, net/http | distroless/static |
|
|
300
|
+
| Java | Spring Boot, Quarkus, Micronaut, Vert.x | temurin:21-jre-alpine |
|
|
301
|
+
| Ruby | Rails, Sinatra, Hanami, Grape | ruby:3.x-slim |
|
|
302
|
+
| Rust | Actix-web, Axum, Warp, Rocket | distroless/cc |
|
|
303
|
+
| PHP | Laravel, Symfony, Slim, Lumen | php:8.x-fpm-alpine |
|
|
304
|
+
| .NET | ASP.NET Core, Blazor | dotnet/aspnet:8.0-alpine |
|
|
305
|
+
|
|
306
|
+
## Auto-detected Databases
|
|
307
|
+
|
|
308
|
+
ContainerForge scans your dependency files and env vars to detect:
|
|
309
|
+
|
|
310
|
+
| Database | Image | Auto-wired env var |
|
|
311
|
+
|---|---|---|
|
|
312
|
+
| PostgreSQL | postgres:16-alpine | DATABASE_URL |
|
|
313
|
+
| MySQL | mysql:8-oracle | DATABASE_URL |
|
|
314
|
+
| Redis | redis:7-alpine | REDIS_URL |
|
|
315
|
+
| MongoDB | mongo:7 | MONGODB_URI |
|
|
316
|
+
| Elasticsearch | elasticsearch:8.x | ELASTICSEARCH_URL |
|
|
317
|
+
| RabbitMQ | rabbitmq:3-management | RABBITMQ_URL |
|
|
318
|
+
| Apache Kafka | confluentinc/cp-kafka:7.x | KAFKA_BROKERS |
|
|
319
|
+
|
|
320
|
+
## Sidecar Watchdog
|
|
321
|
+
|
|
322
|
+
Every app gets a FastAPI sidecar container that:
|
|
323
|
+
|
|
324
|
+
- Polls `/health` every 10 seconds
|
|
325
|
+
- Auto-restarts the app container after 3 consecutive failures (via Docker socket)
|
|
326
|
+
- Exports Prometheus metrics at `:9090/sidecar/metrics`
|
|
327
|
+
- Serves status/history at `:9090/sidecar/status`
|
|
328
|
+
- Optionally sends webhook alerts (Slack/PagerDuty)
|
|
329
|
+
|
|
330
|
+
## OCI Compliance
|
|
331
|
+
|
|
332
|
+
All generated Dockerfiles follow the [OCI Image Spec](https://specs.opencontainers.org/image-spec/):
|
|
333
|
+
|
|
334
|
+
- `org.opencontainers.image.*` labels on every image
|
|
335
|
+
- `syntax=docker/dockerfile:1.6` BuildKit header
|
|
336
|
+
- `STOPSIGNAL SIGTERM` on every image
|
|
337
|
+
- Fixed UID/GID non-root user (`1001:1001`)
|
|
338
|
+
- `--platform` ARG for cross-architecture builds
|
|
339
|
+
- Multi-stage builds with minimal runtime layers
|
|
340
|
+
|
|
341
|
+
## Contributing
|
|
342
|
+
|
|
343
|
+
We welcome contributions of all kinds. See [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
|
|
344
|
+
|
|
345
|
+
**Good first issues:**
|
|
346
|
+
|
|
347
|
+
- Add a new language or framework to `analyzer/source_detector.py`
|
|
348
|
+
- Add a new database to `generator/db_wirer.py`
|
|
349
|
+
- Improve Kubernetes resource presets
|
|
350
|
+
- Add a new cloud provider to `cloud/cloud_deployer.py`
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
<div align="center">
|
|
359
|
+
Built with ❤️ by the ContainerForge community
|
|
360
|
+
</div>
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
██████╗ ██████╗ ███╗ ██╗████████╗ █████╗ ██╗███╗ ██╗███████╗██████╗ ██████╗ ███████╗
|
|
5
|
+
██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔══██╗██║████╗ ██║██╔════╝██╔══██╗██╔════╝ ██╔════╝
|
|
6
|
+
██║ ██║ ██║██╔██╗██║ ██║ ███████║██║██╔██╗██║█████╗ ██████╔╝██║ ███╗█████╗
|
|
7
|
+
██║ ██║ ██║██║╚████║ ██║ ██╔══██║██║██║╚████║██╔══╝ ██╔══██╗██║ ██║██╔══╝
|
|
8
|
+
╚██████╗╚██████╔╝██║ ╚███║ ██║ ██║ ██║██║██║ ╚███║███████╗██║ ██║╚██████╔╝███████╗
|
|
9
|
+
╚═════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚══╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Containerize anything. Ship everywhere.**
|
|
13
|
+
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](https://python.org)
|
|
16
|
+
[](CHANGELOG.md)
|
|
17
|
+
[](CONTRIBUTING.md)
|
|
18
|
+
|
|
19
|
+
[Installation](#installation) · [Quick Start](#quick-start) · [Commands](#commands) · [Config](#configuration) · [Contributing](#contributing)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
ContainerForge detects your app's language and framework, generates an OCI-compliant multi-stage Dockerfile, wires up databases, adds a self-healing sidecar with Prometheus metrics, and ships Kubernetes manifests and CI/CD pipelines — all from a single command.
|
|
26
|
+
|
|
27
|
+
## What it does
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
containerforge build ./my-api
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
That one command:
|
|
34
|
+
|
|
35
|
+
1. **Detects** language + framework (Python/Node/Go/Java/Ruby/Rust/PHP/.NET, 40+ frameworks)
|
|
36
|
+
2. **Generates** an OCI-compliant multi-stage Dockerfile (distroless for Go/Rust, slim for everything else)
|
|
37
|
+
3. **Injects** `/health` and `/telemetry` endpoints (Python apps, zero code changes)
|
|
38
|
+
4. **Wires** detected databases (postgres, mysql, redis, mongo, elastic, kafka, rabbitmq) into docker-compose
|
|
39
|
+
5. **Deploys** a sidecar watchdog that auto-restarts failed containers and exports Prometheus metrics
|
|
40
|
+
6. **Scans** the built image with Trivy for CVEs before you push
|
|
41
|
+
7. **Builds** and launches everything with `docker compose up -d`
|
|
42
|
+
|
|
43
|
+
Optional flags unlock more:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
containerforge build ./my-api --with-k8s --with-cicd --with-dash --push docker.io/myorg
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install containerforge
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or install from source:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/containerforge/containerforge
|
|
59
|
+
cd containerforge
|
|
60
|
+
pip install -e .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Optional dependencies:**
|
|
64
|
+
|
|
65
|
+
| Feature | Requirement |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Vulnerability scanning | [Trivy](https://aquasecurity.github.io/trivy/) |
|
|
68
|
+
| AI analysis | `ANTHROPIC_API_KEY` environment variable |
|
|
69
|
+
| Cloud deploy | `aws`/`gcloud`/`az`/`fly` CLIs |
|
|
70
|
+
| Kubernetes | `kubectl` |
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Detect what you have
|
|
76
|
+
containerforge detect ./my-app
|
|
77
|
+
|
|
78
|
+
# Generate all files + build + run
|
|
79
|
+
containerforge build ./my-app
|
|
80
|
+
|
|
81
|
+
# Generate files only (no docker build)
|
|
82
|
+
containerforge build ./my-app --no-build
|
|
83
|
+
|
|
84
|
+
# Full pipeline: k8s + CI/CD + Grafana + push
|
|
85
|
+
containerforge build ./my-app \
|
|
86
|
+
--with-k8s --with-cicd --with-dash \
|
|
87
|
+
--push docker.io/myorg
|
|
88
|
+
|
|
89
|
+
# Write a containerforge.yml to commit to version control
|
|
90
|
+
containerforge init ./my-app
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `build` | Detect + containerize + build + run |
|
|
98
|
+
| `detect` | Scan source dir, report language/framework/OCI metadata |
|
|
99
|
+
| `init` | Write a starter `containerforge.yml` |
|
|
100
|
+
| `scan` | Run Trivy vulnerability scan |
|
|
101
|
+
| `k8s` | Generate Kubernetes manifests |
|
|
102
|
+
| `cicd` | Generate CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins) |
|
|
103
|
+
| `deploy` | Deploy to cloud (aws / gcp / azure / fly) |
|
|
104
|
+
| `dashboard` | Generate Grafana dashboard + Prometheus config |
|
|
105
|
+
| `analyze` | AI-powered containerization quality analysis |
|
|
106
|
+
| `clean` | Remove all generated files |
|
|
107
|
+
| `list-supported` | Show all supported languages, frameworks, clouds |
|
|
108
|
+
|
|
109
|
+
### `build`
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
containerforge build ./my-app [OPTIONS]
|
|
113
|
+
|
|
114
|
+
Options:
|
|
115
|
+
-n, --name TEXT Image/service name (default: directory name)
|
|
116
|
+
-p, --port INT Override detected port
|
|
117
|
+
-t, --tag TEXT Docker image tag (default: latest)
|
|
118
|
+
-l, --lang TEXT Override language detection
|
|
119
|
+
-f, --framework TEXT Override framework detection
|
|
120
|
+
--platform TEXT OCI target platform (default: linux/amd64)
|
|
121
|
+
--no-inject Skip /health endpoint injection
|
|
122
|
+
--no-scan Skip Trivy scan
|
|
123
|
+
--no-build Generate files only
|
|
124
|
+
--no-run Build image but skip compose up
|
|
125
|
+
--with-k8s Also generate Kubernetes manifests
|
|
126
|
+
--with-cicd Also generate CI/CD pipelines
|
|
127
|
+
--with-dash Also generate Grafana dashboard
|
|
128
|
+
--push TEXT Push to registry after build
|
|
129
|
+
--ai Run LLM analysis (requires ANTHROPIC_API_KEY)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `k8s`
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
containerforge k8s ./my-app --namespace production --replicas 3 --ingress --hpa
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Generates `k8s/` with:
|
|
139
|
+
- `00-namespace.yaml` — Namespace
|
|
140
|
+
- `01-serviceaccount.yaml` — ServiceAccount (no token automount)
|
|
141
|
+
- `02-configmap.yaml` — Non-sensitive env vars
|
|
142
|
+
- `03-secret.yaml` — Secret template (never commit real values)
|
|
143
|
+
- `04-deployment.yaml` — Deployment with liveness/readiness/startup probes, resource limits, anti-affinity, seccomp
|
|
144
|
+
- `05-service.yaml` — ClusterIP Service
|
|
145
|
+
- `06-networkpolicy.yaml` — Deny-all NetworkPolicy with explicit allowances
|
|
146
|
+
- `07-pdb.yaml` — PodDisruptionBudget (minAvailable: 1)
|
|
147
|
+
- `08-ingress.yaml` — Ingress with cert-manager TLS (optional)
|
|
148
|
+
- `09-hpa.yaml` — HorizontalPodAutoscaler (optional)
|
|
149
|
+
- `kustomization.yaml` — Kustomize entry point
|
|
150
|
+
|
|
151
|
+
### `cicd`
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
containerforge cicd ./my-app --provider github
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Generates pipelines with stages: **test → build → scan (Trivy/SARIF) → push → deploy**
|
|
158
|
+
|
|
159
|
+
- **GitHub Actions** — `.github/workflows/containerforge.yml`
|
|
160
|
+
- Uploads Trivy results to GitHub Security tab
|
|
161
|
+
- Generates + uploads SBOM artifact
|
|
162
|
+
- Multi-platform builds (amd64 + arm64) on push to main
|
|
163
|
+
- **GitLab CI** — `.gitlab-ci.yml`
|
|
164
|
+
- Container scanning report
|
|
165
|
+
- Manual deploy gate to production
|
|
166
|
+
- **Jenkins** — `Jenkinsfile` (declarative pipeline)
|
|
167
|
+
|
|
168
|
+
### `deploy`
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
containerforge deploy ./my-app --provider aws --region us-east-1
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Provider | Service | IaC |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `aws` | ECS Fargate | CloudFormation + deploy script |
|
|
177
|
+
| `gcp` | Cloud Run | Cloud Run YAML + deploy script |
|
|
178
|
+
| `azure` | Container Apps | Bicep + deploy script |
|
|
179
|
+
| `fly` | Fly.io Machines | fly.toml + deploy script |
|
|
180
|
+
|
|
181
|
+
Use `--gen-only` to write IaC files without executing the deploy.
|
|
182
|
+
|
|
183
|
+
### `analyze`
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
187
|
+
containerforge analyze ./my-app
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Uses Claude to review your Dockerfile and source code. Returns:
|
|
191
|
+
- Production readiness score (0–100) with breakdown by category
|
|
192
|
+
- Security issues (hardcoded secrets, non-root user, missing caps)
|
|
193
|
+
- Dockerfile optimizations (layer caching, image size, multi-stage)
|
|
194
|
+
- Top 5 ranked recommendations with code snippets
|
|
195
|
+
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
Create `containerforge.yml` in your app directory (or run `containerforge init ./my-app`):
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
# containerforge.yml — commit this to version control
|
|
202
|
+
name: my-api
|
|
203
|
+
lang: python
|
|
204
|
+
framework: flask
|
|
205
|
+
port: 5000
|
|
206
|
+
tag: latest
|
|
207
|
+
platform: linux/amd64
|
|
208
|
+
|
|
209
|
+
# Observability
|
|
210
|
+
sidecar_port: 9090
|
|
211
|
+
inject_health: true
|
|
212
|
+
|
|
213
|
+
# Security
|
|
214
|
+
scan: true
|
|
215
|
+
sbom: false
|
|
216
|
+
|
|
217
|
+
# Databases (auto-detected, or specify explicitly)
|
|
218
|
+
databases:
|
|
219
|
+
- postgres
|
|
220
|
+
- redis
|
|
221
|
+
|
|
222
|
+
# Secrets to expose as env vars
|
|
223
|
+
env_secrets:
|
|
224
|
+
- DATABASE_URL
|
|
225
|
+
- SECRET_KEY
|
|
226
|
+
|
|
227
|
+
# Registry
|
|
228
|
+
push_registry: docker.io/myorg
|
|
229
|
+
|
|
230
|
+
# Kubernetes
|
|
231
|
+
k8s:
|
|
232
|
+
namespace: production
|
|
233
|
+
replicas: 3
|
|
234
|
+
ingress: true
|
|
235
|
+
ingress_host: api.example.com
|
|
236
|
+
hpa: true
|
|
237
|
+
min_replicas: 2
|
|
238
|
+
max_replicas: 20
|
|
239
|
+
|
|
240
|
+
# Cloud deploy
|
|
241
|
+
cloud:
|
|
242
|
+
provider: aws
|
|
243
|
+
region: us-east-1
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
CLI flags always override `containerforge.yml` values.
|
|
247
|
+
|
|
248
|
+
## Supported Languages & Frameworks
|
|
249
|
+
|
|
250
|
+
| Language | Frameworks | Runtime Image |
|
|
251
|
+
|---|---|---|
|
|
252
|
+
| Python | Flask, FastAPI, Django, Starlette, Tornado, aiohttp, Sanic, Bottle, Litestar | python:3.x-slim |
|
|
253
|
+
| Node.js | Express, Fastify, Next.js, NestJS, Koa, Hapi, Nuxt | node:20-alpine |
|
|
254
|
+
| Go | Gin, Echo, Fiber, Chi, Gorilla Mux, net/http | distroless/static |
|
|
255
|
+
| Java | Spring Boot, Quarkus, Micronaut, Vert.x | temurin:21-jre-alpine |
|
|
256
|
+
| Ruby | Rails, Sinatra, Hanami, Grape | ruby:3.x-slim |
|
|
257
|
+
| Rust | Actix-web, Axum, Warp, Rocket | distroless/cc |
|
|
258
|
+
| PHP | Laravel, Symfony, Slim, Lumen | php:8.x-fpm-alpine |
|
|
259
|
+
| .NET | ASP.NET Core, Blazor | dotnet/aspnet:8.0-alpine |
|
|
260
|
+
|
|
261
|
+
## Auto-detected Databases
|
|
262
|
+
|
|
263
|
+
ContainerForge scans your dependency files and env vars to detect:
|
|
264
|
+
|
|
265
|
+
| Database | Image | Auto-wired env var |
|
|
266
|
+
|---|---|---|
|
|
267
|
+
| PostgreSQL | postgres:16-alpine | DATABASE_URL |
|
|
268
|
+
| MySQL | mysql:8-oracle | DATABASE_URL |
|
|
269
|
+
| Redis | redis:7-alpine | REDIS_URL |
|
|
270
|
+
| MongoDB | mongo:7 | MONGODB_URI |
|
|
271
|
+
| Elasticsearch | elasticsearch:8.x | ELASTICSEARCH_URL |
|
|
272
|
+
| RabbitMQ | rabbitmq:3-management | RABBITMQ_URL |
|
|
273
|
+
| Apache Kafka | confluentinc/cp-kafka:7.x | KAFKA_BROKERS |
|
|
274
|
+
|
|
275
|
+
## Sidecar Watchdog
|
|
276
|
+
|
|
277
|
+
Every app gets a FastAPI sidecar container that:
|
|
278
|
+
|
|
279
|
+
- Polls `/health` every 10 seconds
|
|
280
|
+
- Auto-restarts the app container after 3 consecutive failures (via Docker socket)
|
|
281
|
+
- Exports Prometheus metrics at `:9090/sidecar/metrics`
|
|
282
|
+
- Serves status/history at `:9090/sidecar/status`
|
|
283
|
+
- Optionally sends webhook alerts (Slack/PagerDuty)
|
|
284
|
+
|
|
285
|
+
## OCI Compliance
|
|
286
|
+
|
|
287
|
+
All generated Dockerfiles follow the [OCI Image Spec](https://specs.opencontainers.org/image-spec/):
|
|
288
|
+
|
|
289
|
+
- `org.opencontainers.image.*` labels on every image
|
|
290
|
+
- `syntax=docker/dockerfile:1.6` BuildKit header
|
|
291
|
+
- `STOPSIGNAL SIGTERM` on every image
|
|
292
|
+
- Fixed UID/GID non-root user (`1001:1001`)
|
|
293
|
+
- `--platform` ARG for cross-architecture builds
|
|
294
|
+
- Multi-stage builds with minimal runtime layers
|
|
295
|
+
|
|
296
|
+
## Contributing
|
|
297
|
+
|
|
298
|
+
We welcome contributions of all kinds. See [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
|
|
299
|
+
|
|
300
|
+
**Good first issues:**
|
|
301
|
+
|
|
302
|
+
- Add a new language or framework to `analyzer/source_detector.py`
|
|
303
|
+
- Add a new database to `generator/db_wirer.py`
|
|
304
|
+
- Improve Kubernetes resource presets
|
|
305
|
+
- Add a new cloud provider to `cloud/cloud_deployer.py`
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
<div align="center">
|
|
314
|
+
Built with ❤️ by the ContainerForge community
|
|
315
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ContainerForge — Containerize anything. Ship everywhere.
|
|
3
|
+
|
|
4
|
+
Version: 2.1.1
|
|
5
|
+
License: Apache 2.0
|
|
6
|
+
"""
|
|
7
|
+
__version__ = "2.1.1"
|
|
8
|
+
__author__ = "ContainerForge Contributors"
|
|
9
|
+
__license__ = "Apache-2.0"
|
|
10
|
+
|
|
11
|
+
# cli is intentionally NOT imported here — it has heavy deps (rich, click).
|
|
12
|
+
# The entry_point in pyproject.toml points directly to containerforge.cli:cli
|