1
0
Fork 0
Go to file
Dustin 4fbc5ca781
dustin/pythonctnr/pipeline/head Something is wrong with the build of this commit Details
ci: Publish to Gitea
registry.pyrocufflink.blue is going away.  All container images hosted
there are being moved to Gitea.
2022-12-21 11:12:47 -06:00
ci ci: Publish to Gitea 2022-12-21 11:12:47 -06:00
configs ci: Enable ccache for buildroot 2022-10-31 12:03:52 -05:00
.gitignore Initial commit 2022-08-07 10:36:18 -05:00
Config.in Initial commit 2022-08-07 10:36:18 -05:00
README.md Initial commit 2022-08-07 10:36:18 -05:00
external.desc Initial commit 2022-08-07 10:36:18 -05:00
external.mk Initial commit 2022-08-07 10:36:18 -05:00

README.md

Minimal Base Python Container Image

The pythonctnr image contains ONLY the Python runtime, and nothing else. It is suitable for deploying applications written in pure Python, without any external library dependencies. No shell or other OS utilities are included. Just /usr/bin/python3 and the libraries it needs to run.

Building

The contents of the container image are built with buildroot.

make -C ~/src/buildroot O=${PWD}/_build pythonctnr_defconfig
make -C _build

This will produce a rootfs.tar tarball in _build/images, which is then converted to a container image using buildah.

ctnr=$(buildah from scratch)
buildah add ${ctnr} _build/images/rootfs.tar /
buildah commit ${ctnr} pythonctnr:latest

Usage

The container image can be used like any other image, e.g. in a Dockerfile. pip is included, to allow installing Python distribution packages.

FROM pythonctnr

RUN ["/usr/bin/python3", "-m", "pip", "install", "mypkg"]

NOTE: Because there is no shell, the default string form of the RUN instruction does not work. You must use the exec form.