Small example showing how to build and run a minimal (distroless-style) Docker image for a Python service.
This repository contains a simple Python application and a Dockerfile configured to produce a small runtime image. It's intended as a minimal starting point for packaging Python services with a distroless-like approach.
- Python 3.9+ (for local development)
- Docker (for building images)
- docker-compose (optional, for multi-container setups)
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Run the app (example):
python main.pyOpen http://localhost:8000 (or the port your app uses).
Build the Docker image using the repository Dockerfile:
docker build -t python-distroless -f Dockerfile .Run the image:
docker run --rm -p 8000:8000 python-distrolessAdjust ports and entrypoint as needed for your application.
If you prefer docker compose (v2+), start the service with:
docker compose up -dStop and remove containers:
docker compose downSuggestions and improvements welcome. Open an issue or a pull request with proposed changes.
This project is licensed under the MIT License — see LICENSE.