Metadata-Version: 2.4
Name: docker-opt
Version: 0.2.0
Summary: Python-first Dockerfile optimizer CLI
Author: docker-opt contributors
License: ﻿MIT License
        
        Copyright (c) 2026 docker-opt contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: devops,docker,dockerfile,lint,optimizer,security
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Requires-Dist: typer>=0.12.3
Provides-Extra: dev
Requires-Dist: build>=1.2.1; extra == 'dev'
Requires-Dist: pyinstaller>=6.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Description-Content-Type: text/markdown

﻿# docker-opt

Python-first Dockerfile optimizer CLI. It analyzes Dockerfiles, flags size/security/caching issues, outputs JSON for CI, generates a safe optimized Python template, and creates a .dockerignore.

## Install

```powershell
pip install docker-opt
```

## Usage

```powershell
# Analyze
docker-opt analyze -f Dockerfile

# JSON output
docker-opt analyze -f Dockerfile --json

# CI: minimal output + fail on MEDIUM and HIGH
docker-opt analyze -f Dockerfile --ci --fail-on MEDIUM

# Generate optimized template
docker-opt fix -f Dockerfile --stdout

# Write optimized template to file
docker-opt fix -f Dockerfile -o Dockerfile.optimized

# Generate .dockerignore
docker-opt dockerignore --type python
docker-opt dockerignore --type python --out .dockerignore
```

## CI Exit Codes

- Exit code is non-zero if any finding severity is >= `--fail-on`.
- In `--ci` mode, output is reduced to a single summary line (unless `--json`).

 

## Build and Publish

### Local build (sdist/wheel + exe)

```powershell
.\scripts\build.ps1
dist\docker-opt.exe --help
```

### Publish to PyPI

```powershell
.\scripts\publish.ps1           # TestPyPI
.\scripts\publish.ps1 -Target prod
```

## Release Workflow (GitHub Actions)

- Tag a release: `vX.Y.Z`
- CI runs tests on Windows and Ubuntu.
- Release workflow builds sdist/wheel, Windows exe, creates a GitHub Release, and uploads artifacts.
- PyPI publishing uses trusted publishing if configured; otherwise use TWINE secrets.

## Samples

- `samples/python-fastapi/` includes a minimal FastAPI app with Dockerfile and .dockerignore.

## Notes

Each finding includes severity and an impact band (SECURITY, SIZE, CACHE, REPRODUCIBILITY, PERFORMANCE, MAINTAINABILITY, FUNCTIONAL, OBSERVABILITY, RELIABILITY).

## Support / Donate

This project is free and open; donations help maintenance.

If docker-opt helps you, consider supporting its development:

https://buymeacoffee.com/sathsara2000

### Donation URL override

You can override the donation URL with an environment variable:

```powershell
$env:DOCKER_OPT_DONATION_URL = "https://example.com/your-donation-link"
docker-opt donate
```

### Stripe Payment Link (one-time)

If you want to use Stripe for one-time donations:

1. Sign in to Stripe and open the Dashboard.
2. Go to `Payments` > `Payment Links`.
3. Click `New`, choose `One-time`, and set the amount and description.
4. Create the link and copy its URL.
5. Set it as `DOCKER_OPT_DONATION_URL` or replace the link above.
