Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ivt-py

A small whoami-style Flask service that echoes request metadata and headers. It is useful for validating reverse proxy, ingress, container, and CI/CD configuration.

App

The app is defined in app.py and exposes these routes:

GET /      plain text request metadata
GET /ip    plain text request metadata
GET /json  JSON request metadata

The Docker runtime assumes the app entrypoint is app:app, which means app.py contains a Python object named app. Override this with APP_MODULE if another project uses a different entrypoint.

Poetry

Install dependencies and run the app:

poetry install
poetry run gunicorn --bind 0.0.0.0:8000 app:app

Dev dependencies include pytest, ruff, and pip-audit. Install them with the default poetry install; the Docker dev and test targets install them with poetry install --with dev.

Run validation:

poetry check --lock
poetry run ruff check .
poetry run pip-audit
poetry run pytest

Dockerfile

The root Dockerfile is a reusable Poetry Dockerfile with multiple targets:

base     Python, Poetry, and project metadata
deps     runtime dependencies only
dev      dev dependencies and source code
test     dev image plus validation commands
runtime  production runtime image

Build targets:

docker build --target base -t ivt-py:base .
docker build --target deps -t ivt-py:deps .
docker build --target dev -t ivt-py:dev .
docker build --target test -t ivt-py:test .
docker build --target runtime -t ivt-py:runtime .

Run the runtime image:

docker run --rm -p 8000:8000 ivt-py:runtime

Override the app entrypoint or port:

docker run --rm -p 8000:8000 -e APP_MODULE=main:app ivt-py:runtime
docker run --rm -p 9000:9000 -e PORT=9000 ivt-py:runtime

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages