Skip to main content

A setuptools extension for building docker images for distribution

Project description

setuptools-docker

A light-weight setuptools extension for building docker images from python projects.

Python wheels are the preferred packaging format for distributing python libraries or applications. However, in cloud native computation services get packaged and deployed as docker/oci images. This project aims at making the packaging of python services for such environments as easy and as repeatable as building a wheel. It takes heavy inspiration from jib.

Usage

setuptools-docker extends setuptools with one additional command: bdist_docker. It will typically be used like this:

python -m setup bdist_docker

For a reference of arguments see python -m setup bdist_docker --help

Configuration via file

setuptools-docker utilizes the configuration mechanisms of setuptools itself, e.g., setup.cfg.

It adds a new section [bdist_docker], e.g.:

[bdist_docker]
extra_requires =
    gunicorn
user_id = 1100
environment_vars =
    FIZZ=BUZZ

Options

Key Type Description Default
image_name str image name (optionally incl. registry) metadata name
image_tag str image tag metadata version
requirements_file str pip requirements file to install into image
extra_requires list extras to install alongside wheel
index_url str pip index url to install dependencies from (pip default index)
index_username str username for authentication to PIP index
index_password str password for authentication to PIP index
base_image str base image for final stage python:3.8-slim-bullseye
extra_os_packages list extra deb packages to install into final stage
builder-extra-os-packages list extra deb packages to install into builder stage
user_id int user id for docker USER directive
entrypoint list entrypoint in exec form
command list command in exec form
init_scripts list path/to/extra/init/scripts to run (prior to provided entrypoint )
pip_cache_docker bool whether to use docker cache for pip cache dir True
environment_vars list environment variables to set via docker ENV directive

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools_docker-0.1.0.tar.gz (16.8 kB view hashes)

Uploaded Source

Built Distribution

setuptools_docker-0.1.0-py2.py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page