Skip to main content

What is Buildr?

Buildr is a Python library that makes building and deploying containers a seamless and idiomatic experience for developers. Instead of writing Dockerfiles and managing build commands separately, you can containerize your Python applications with a simple decorator. With Buildr, your application automatically packages itself as a container and optionally deploys itself - all with minimal configuration.

Key features

Decorator-based API

Transform any Python function into a containerized application with the @Containerize decorator

Auto-generated Dockerfiles

No need to write Dockerfiles manually - Buildr generates optimized Dockerfiles based on your Python version and dependencies

Publish to registries

Publish your container images to Docker Hub or other container registries with a single flag

Runtime configuration

Configure ports, replicas, and execution environments declaratively in your code

How it works

Buildr uses a decorator pattern to wrap your application’s entry point. When you run your application:
  1. Detection: Buildr checks if it’s running inside a container
  2. Build: If not containerized, it generates a Dockerfile and builds the image
  3. Publish: Optionally pushes the image to your container registry
  4. Run: Executes your application inside the container
  5. Logs: Streams container logs back to you

Quick example

Here’s a simple Python application:
def main():
    print('Hello World')

if __name__ == '__main__':
    main()
To containerize it with Buildr, just add the decorator:
from metaparticle_pkg import Containerize

@Containerize(
    package={'name': 'hello-app', 'repository': 'myrepo'}
)
def main():
    print('Hello World')

if __name__ == '__main__':
    main()
When you run this application, Buildr automatically builds a container image and runs your code inside it.

Next steps

Quickstart

Get your first containerized app running in minutes

Installation

Install Buildr and its dependencies

Build docs developers (and LLMs) love