Skip to content

TheMainMamad/python-distroless

Repository files navigation

python-distroless

Small example showing how to build and run a minimal (distroless-style) Docker image for a Python service.

Overview

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.

Prerequisites

  • Python 3.9+ (for local development)
  • Docker (for building images)
  • docker-compose (optional, for multi-container setups)

Quickstart — Local (development)

  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the app (example):
python main.py

Open http://localhost:8000 (or the port your app uses).

Build Docker image

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-distroless

Adjust ports and entrypoint as needed for your application.

Using docker-compose

If you prefer docker compose (v2+), start the service with:

docker compose up -d

Stop and remove containers:

docker compose down

Contributing

Suggestions and improvements welcome. Open an issue or a pull request with proposed changes.

License

This project is licensed under the MIT License — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors