Create production-ready Docker images in just one hour

You’re packaging your Python application with Docker. It’s going to be running in production. And now you have a whole new set of worries:

  • Insecure images will put your production data at risk.
  • Slow CI builds will bottleneck your whole team, wasting expensive developer time.
  • Silent crashes become that much harder to debug, wasting even more developer time.
  • Large images slow deployments and increase your bandwidth costs.

You can’t just take any old Docker image and push it to production. You’re going to have to do some work.

Unfortunately, implementing Docker packaging best practices can take multiple days of development and debugging. There are no elegant abstractions when it comes to packaging—it’s just detail after detail after detail that you need to get right.

And getting all those details right takes time, time you don’t have.

Production-ready, the fast way

Your tools shouldn’t slow you down; your tools should make your team more productive.

With the right infrastructure, your team can spin up new applications faster. And when you deploy a new Docker image, you can be confident that you’re following operational best practices, confident that it’s built right, confident that it’s secure—and all running quickly so your team can be more productive.

But only if you have the right infrastructure.

To help you get there, and get there fast, I’ve created a best-practices template for packaging Python applications with Docker.

What users are saying:

“The template worked great 🙂

The app using it is now live within the hospital’s ICU unit, and I’ll be using the same template to deploy an API (still in development) on the same infrastructure.”

– Nel Swanepol, University College London

“Easy packaging is why we use it. At one point we had invested time trying to make something similar work, but it never worked. Paying for your product saved us a lot of time.”

— RickMendesTech LLC

Watch me package a Python application for Docker—in less than 4 minutes!

In common cases, and once you know how to use the template, packaging can get very quick indeed. Watch as I package a web application in less than 4 minutes; I recommend opening it full-screen (the button on the bottom-right of the video):


How will the template save you time?

  • Specifically designed for Python applications, with automatic support for most Python packaging setups (requirements.txt, setup.py, Pipenv, Poetry, and flit).
  • Installs dependencies separately from application code when possible, for faster builds.
  • Pre-configured with fast multi-stage builds, to help you build smaller images.
  • Secure defaults, running your code as a non-root user, shipping the minimal files needed, and setting up best practices like automatic image rebuilds.
  • Pre-configured for GitHub Actions and GitLab CI, so you can get started even faster.
  • Up-to-date with the latest Docker 20.10 and BuildKit support.

How do you use the template?

In order to make things as simple and easy as possible, and get you started quickly, the template comes with highly detailed step-by-step tutorial. You can preview it here.

Most of the time you’ll run the install script, tweak a couple of configuration parameters, modify the entrypoint script to run your application–and that’s it! And if for some reason you need to make more significant changes, well, it’s a template–you can change anything you need to.

Want production-ready Docker images for your application, today?

(Need Conda support? Check out my Conda-based template instead.)

  • Configured for production use: small images, secure defaults.
  • Fast setup and fast builds, saving you days of ops and developer time.
  • Extensively tested with the latest version of Docker (20.10) as well as BuildKit.
  • Use for an unlimited number of images in your company's private repositories.
  • Use the resulting images on Heroku, Kubernetes, or anywhere else you can run a Docker image.
Production-ready Python Containers Template
  • Latest release, from September 2022; see the changelog).
  • Use the template forever.
  • All updates to v2, delivered by email.
  • 100% money-back guarantee.

Note: I prefer not to take money from teams working on projects for (A) the military, surveillance, or national security (B) prisons or police, (C) fossil fuel extraction or blockchain. If any of these categories apply to you, please don’t purchase this product.

Still not sure?

Read my article on how to decide whether to buy a product, and how to convince your boss to pay for it.

Licensing terms

You can use the template for an unlimited number of images, forever. What you can’t do is redistribute the template itself.

That means:

  1. You won’t be able to distribute images based on the template outside your organization, if they include the template’s code.
  2. You won’t be able to distribute the template as part of the source code of your project, if you send source code to customers.
  3. You won’t be able use it to package an open source project.

If you have questions, or would like a custom licensing agreement to address these limitations, get in touch at sales@pythonspeed.com.

You can read the specific license terms here.

Is this template for you?

Designed for production, not development environments

Some developers use Docker for development environments, or to run data science batch jobs locally, or other local use cases. This template is designed for running services on production servers.

Prerequisite knowledge

In order to use this template successfully, developers are expected to understand:

  • Basic Docker usage, including docker run/build/ps/... commands and the Dockerfile format.
  • Python packaging, e.g. specifying dependencies in a requirements.txt file.
  • Linux command-line usage.
  • The details of your CI system.

Won’t magically solve all your operational problems

This template is far better than what most developers can do on their own without a significant and costly time investment.

However, Docker packaging is just one part of your operational and deployment infrastructure, and it can’t fix problems in your code. So even if you use this template you might still have security breaches, crashes, or other problems.

Some industries I prefer not to do business with

Note: I prefer not to take money from teams working on projects for (A) the military, surveillance, or national security (B) prisons or police, (C) fossil fuel extraction or blockchain. If any of these categories apply to you, please don’t purchase this product.

Not for hobbyists

If you’re just working on a personal project, I wouldn’t suggest paying for this template. This template is for organizations running software in production, where downtime and slowness cost real money.

Want to build production-ready containers?

(Need Conda support? Check out my Conda-based template instead.)

  • Configured for production use: small images, secure defaults.
  • Fast setup and fast builds, saving you days of ops and developer time.
  • Extensively tested with the latest version of Docker (20.10) as well as BuildKit.
  • Use for an unlimited number of images in your company's private repositories.
  • Use the resulting images on Heroku, Kubernetes, or anywhere else you can run a Docker image.
Production-ready Python Containers Template
  • Latest release, from September 2022; see the changelog).
  • Use the template forever.
  • All updates to v2, delivered by email.
  • 100% money-back guarantee.

Note: I prefer not to take money from teams working on projects for (A) the military, surveillance, or national security (B) prisons or police, (C) fossil fuel extraction or blockchain. If any of these categories apply to you, please don’t purchase this product.

Still not sure?

Read my article on how to decide whether to buy a product, and how to convince your boss to pay for it.

Changelog

2.0.2 (September 2022)

  • Support for newer versions of Pipenv.
  • Compatibility with releases of Poetry after 1.2, where the export plugin will need to be installed separately.
  • Default to Python 3.10 in the Dockerfile.

2.0.1 (April 2022)

  • Switched Poetry support to install dependencies directly using poetry instead of pip, which makes supporting third-party package repositories easier.

2.0.0 (January 2022)

  • After 2.5 years of updates to the 1.x version, this updated release is simplified and streamlined.
  • Reduced configuration options, replacing them with examples.
  • Improved Git and Compose support.
  • Removed support for features obsoleted by modern Docker.