{"id":16847459,"url":"https://github.com/indygreg/docker-build-python","last_synced_at":"2025-10-25T01:44:33.086Z","repository":{"id":23193596,"uuid":"26550036","full_name":"indygreg/docker-build-python","owner":"indygreg","description":"Build standalone and reusable Python installations from Docker","archived":false,"fork":false,"pushed_at":"2014-11-12T18:43:05.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T07:17:07.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indygreg.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-12T18:30:35.000Z","updated_at":"2024-07-01T00:42:19.000Z","dependencies_parsed_at":"2022-08-21T21:30:54.654Z","dependency_job_id":null,"html_url":"https://github.com/indygreg/docker-build-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/indygreg/docker-build-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fdocker-build-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fdocker-build-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fdocker-build-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fdocker-build-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indygreg","download_url":"https://codeload.github.com/indygreg/docker-build-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indygreg%2Fdocker-build-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280893652,"owners_count":26409279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T13:08:01.992Z","updated_at":"2025-10-25T01:44:33.061Z","avatar_url":"https://github.com/indygreg.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"==================================\nBuild Python Packages Using Docker\n==================================\n\nIs your operating system still stuck on Python 2.6? Do you want to move to\nPython 2.7 or newer? This project is for you.\n\nPython is a core component of operating systems. So, operating systems\ncan't easily upgrade the system Python install without a) breaking\nbackwards compatibility b) possibly breaking parts of the operating system\nthat rely on the older version of Python.\n\nSince the operating system's Python is effectively frozen, people wishing\nto deploy a newer Python must create a separate Python installation separate\nfrom the system's. This project builds standalone Python installations\n(using Docker) that can be transferred to and install on multiple machines\nfor use side-by-side the system's Python installation.\n\nUsing Docker to Build Python\n============================\n\nThis project contains Docker environments for building Python from source and\nfor packaging that Python installation so it can easily be installed\non multiple machines.\n\nHow It Works\n------------\n\nGo to the directory of the operating system / distro you wish to build Python\nfor. Then, build and launch a Docker image that will build and package Python\nfor you.::\n\n  $ cd centos6\n  $ docker build -t pybuild-centos6 .\n  $ docker run --rm -it pybuild-centos6\n\nThen, follow the instructions to obtain an archive of the built Python\ninstallation, which you can distribute to all your machines.\n\nPython embeds some self-referential links in its installation. This means that\nthe directory we install Python into inside Docker **must be identical** to the\ndirectory the archive is uncompressed to. The default location is\n``/usr/local/python``.\n\nConfiguration\n=============\n\nBy default, modern versions of Python, setuptools, pip, and virtualenv are\ninstalled into ``/usr/local/python``. If you would like to change the versions\nor installation location, you can set some environment variables.\n\nPYTHON_VERSION\n   The version of CPython to download and install.\nSETUPTOOLS_VERSION\n   The version of setuptools to install. This corresponds to a tag or changeset\n   from the setuptools Mercurial repository.\nPIP_VERSION\n   The version of pip to install. This corresponds to a tag or commit from the pip\n   Git repository.\nVIRTUALENV_VERSION\n   The version of virtualenv to install. This corresponds to a tag or commit from\n   virtualenv Git repository.\nPYTHON_INSTALL_DIR\n   Prefix where we should install Python.\n\nFor example, to install Python in ``/opt/python27`` instead::\n\n  $ docker run --rm -it -e PYTHON_INSTALL_DIR=/opt/python27 pybuild-centos6\n\nKnown Issues and Limitations\n============================\n\nThis project is only tested on Python 2.7 and modern version (late 2014)\nversions of setuptools, pip, and virtualenv.\n\nWe should probably do GPG verification of downloaded source and/or tags.\n\nAs new operating systems are added, we'll have a lot of redundant code. We\nmay want to provide a script that builds a Docker image from a dynamically\ncreated, in-memory archive. See\nhttps://hg.mozilla.org/hgcustom/version-control-tools/file/3ba7235c8b66/testing/vcttesting/docker.py#l122\nfor inspiration.\n\nWe are solving *building Python*, which has been solved before.\nWe may want to incorporate pyenv's\n`python-build \u003chttps://github.com/yyuu/pyenv/blob/master/plugins/python-build/bin/python-build\u003e`_\nscript so we don't have to reinvent the wheel. That being said, python-build\nassumes a variable system. Courtesy of Docker, our system state should be\nbetter-defined, so we don't need so much complexity.\n\nThe original project author is not 100% certain that others have not solved\nthis exact problem before. The author is aware of projects like pyenv.\nHowever, the main purpose this project facilitates that the author believes\nto be unique is the ability to easily produce a standalone Python installation\nwhich can easily be distributed among several machines, independent of\noperating system packaging. The author would appreciate enlightenment if he\nis wrong.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findygreg%2Fdocker-build-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findygreg%2Fdocker-build-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findygreg%2Fdocker-build-python/lists"}