{"id":28493078,"url":"https://github.com/hhftechnology/alpine-python","last_synced_at":"2026-01-30T00:38:50.744Z","repository":{"id":267592974,"uuid":"901287806","full_name":"hhftechnology/alpine-python","owner":"hhftechnology","description":"Python running on Alpine Linux [docker] [amd64/armhf/aarch64]","archived":false,"fork":false,"pushed_at":"2024-12-11T02:41:32.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T09:07:22.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","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/hhftechnology.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T11:37:57.000Z","updated_at":"2024-12-11T02:41:35.000Z","dependencies_parsed_at":"2024-12-11T08:48:31.102Z","dependency_job_id":null,"html_url":"https://github.com/hhftechnology/alpine-python","commit_stats":null,"previous_names":["hhftechnology/alpine-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hhftechnology/alpine-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhftechnology%2Falpine-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhftechnology%2Falpine-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhftechnology%2Falpine-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhftechnology%2Falpine-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhftechnology","download_url":"https://codeload.github.com/hhftechnology/alpine-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhftechnology%2Falpine-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264200736,"owners_count":23571827,"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","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":"2025-06-08T09:07:25.622Z","updated_at":"2026-01-30T00:38:45.712Z","avatar_url":"https://github.com/hhftechnology.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alpine-python\n\n[![Docker Stars](https://img.shields.io/docker/stars/hhftechnology/alpine-python.svg)][hub]\n[![Docker Pulls](https://img.shields.io/docker/pulls/hhftechnology/alpine-python.svg)][hub]\n[![Build Status](https://travis-ci.org/hhftechnology/alpine-python.svg?branch=master)][travis]\n\n[hub]: https://hub.docker.com/r/hhftechnology/alpine-python/\n[travis]: https://travis-ci.org/hhftechnology/alpine-python\n\nA small Python Docker image based on [Alpine Linux](http://alpinelinux.org/).\n\n\u003c!-- MDTOC maxdepth:6 firsth1:0 numbering:0 flatten:0 bullets:1 updateOnSave:1 --\u003e\n\n- [alpine-python](#alpine-python)\n  - [Supported tags](#supported-tags)\n  - [Why?](#why)\n  - [Details](#details)\n  - [Usage](#usage)\n  - [Usage of `onbuild` images](#usage-of-onbuild-images)\n  - [Usage of `slim` images](#usage-of-slim-images)\n      - [Via `docker run`](#via-docker-run)\n      - [Pip Dependencies](#pip-dependencies)\n      - [Run-Time Dependencies](#run-time-dependencies)\n      - [Build-Time Dependencies](#build-time-dependencies)\n      - [Creating Images](#creating-images)\n      - [Debugging](#debugging)\n      - [Additional Arguments](#additional-arguments)\n  - [Ecosystem](#ecosystem)\n  - [Contribution](#contribution)\n  - [License](#license)\n\n\u003c!-- /MDTOC --\u003e\n\n## Supported tags\n* **`2.7` ([2.7/Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/2.7/Dockerfile))**\n* **`2.7-onbuild` ([2.7-onbuild/Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/2.7-onbuild/Dockerfile))**\n* **`2.7-slim` ([2.7-slim/Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/2.7-slim/Dockerfile))**\n* **`3.6` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.6/Dockerfile))**\n* **`3.6-onbuild` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.6-onbuild/Dockerfile))**\n* **`3.6-slim` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.6-slim/Dockerfile))**\n* **`3.7` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.7/Dockerfile))**\n* **`3.7-onbuild` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.7-onbuild/Dockerfile))**\n* **`3.7-slim` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.7-slim/Dockerfile))**\n* **`3.8` `latest` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.8/Dockerfile))**\n* **`3.8-onbuild` `latest-onbuild` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.8-onbuild/Dockerfile))**\n* **`3.8-slim` `latest-slim` ([Dockerfile](https://github.com/hhftechnology/alpine-python/blob/master/3.8-slim/Dockerfile))**\n\n**NOTES:**\n- `onbuild` images install the `requirements.txt` of your project from the get go. This allows you to cache your requirements right in the build. _Make sure you are in the same directory of your `requirements.txt` file_.\n\n## Why?\nThe default docker python images are too [big](https://github.com/docker-library/python/issues/45), much larger than they need to be. Hence I built this simple image based on [docker-alpine](https://github.com/gliderlabs/docker-alpine), that has everything needed for the most common python projects - including `python-dev` (which is not common in most minimal alpine python packages).\n\n|REPOSITORY|TAG|SIZE|\n|-|-|-|\n|hhftechnology/alpine-python|2.7-slim|60MB|\n|python|2.7-slim|120MB|\n|python|2.7-alpine|61.2MB|\n||||\n|hhftechnology/alpine-python|2.7|235MB|\n|python|2.7|912MB|\n||||\n|hhftechnology/alpine-python|3.6-slim|76.3MB|\n|python|3.6-slim|138MB|\n|python|3.6-alpine|79MB|\n||||\n|hhftechnology/alpine-python|3.6|252MB|\n|python|3.6|922MB|\n||||\n|hhftechnology/alpine-python|3.7-slim|80.4MB|\n|python|3.7-slim|86.7MB|\n|python|3.7-alpine|143MB|\n||||\n|hhftechnology/alpine-python|3.7|256MB|\n|python|3.7|927MB|\n\nPerhaps this could be even smaller, but I'm not an Alpine guru. **Feel free to post a PR.**\n\n## Details\n* Installs `build-base` and `python-dev`, allowing the use of more advanced packages such as `gevent`\n* Installs `bash` allowing interaction with the container\n* Just like the main `python` docker image, it creates useful symlinks that are expected to exist, e.g. `python3` \u003e `python`, `pip2.7` \u003e `pip`, etc.)\n* Added `testing` and `community` repositories to Alpine's `/etc/apk/repositories` file\n\n## Usage\n\nThis image runs `python` command on `docker run`. You can either specify your own command, e.g:\n```shell\ndocker run --rm -ti hhftechnology/alpine-python python hello.py\n```\n\nYou can also access `bash` inside the container:\n```shell\ndocker run --rm -ti hhftechnology/alpine-python bash\n```\n\n## Usage of `onbuild` images\n\nThese images can be used to bake your dependencies into an image by extending the plain python images. To do so, create a custom `Dockerfile` like this:\n```dockerfile\nFROM hhftechnology/alpine-python:3.6-onbuild\n\n# for a flask server\nEXPOSE 5000\nCMD python manage.py runserver\n```\n\nDon't forget to build that `Dockerfile`:\n```shell\ndocker build --rm=true -t hhftechnology/app .\n\ndocker run --rm -t hhftechnology/app\n```\n\nPersonally, I build an extended `Dockerfile` version (like shown above), and mount my specific application inside the container:\n```shell\ndocker run --rm -v \"$(pwd)\":/home/app -w /home/app -p 5000:5000 -ti hhftechnology/app\n```\n\n## Usage of `slim` images\n\nThese images are very small to download, and can install requirements at run-time via flags. The install only happens the first time the container is run, and dependencies can be baked in (see Creating Images).\n\n#### Via `docker run`\nThese images can be run in multiple ways. With no arguments, it will run `python` interactively:\n```shell\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim\n```\n\nIf you specify a command, they will run that:\n```shell\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim python hello.py\n```\n\n#### Pip Dependencies\nPip dependencies can be installed by the `-p` switch, or a `requirements.txt` file.\n\nIf the file is at `/requirements.txt` it will be automatically read for dependencies. If not, use the `-P` or `-r` switch to specify a file.\n```shell\n# This runs interactive Python with 'simplejson' and 'requests' installed\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim -p simplejson -p requests\n\n# Don't forget to add '--' after your dependencies to run a custom command:\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim -p simplejson -p requests -- python hello.py\n\n# This accomplishes the same thing by mounting a requirements.txt in:\necho 'simplejson' \u003e requirements.txt\necho 'requests' \u003e requirements.txt\ndocker run --rm -ti \\\n  -v requirements.txt:/requirements.txt \\\n  hhftechnology/alpine-python:2.7-slim python hello.py\n\n# This does too, but with the file somewhere else:\necho 'simplejson requests' \u003e myapp/requirements.txt\ndocker run --rm -ti \\\n  -v myapp:/usr/src/app \\\n  hhftechnology/alpine-python:2.7-slim \\\n    -r /usr/src/app/requirements.txt \\\n    -- python /usr/src/app/hello.py\n```\n\n#### Run-Time Dependencies\nAlpine package dependencies can be installed by the `-a` switch, or an `apk-requirements.txt` file.\n\nIf the file is at `/apk-requirements.txt` it will be automatically read for dependencies. If not, use the `-A` switch to specify a file.\n\nYou can also try installing some Python modules via this method, but it is possible for Pip to interfere if it detects a version problem.\n```shell\n# Unknown why you'd need to do this, but you can!\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim -a openssl -- python hello.py\n\n# This installs libxml2 module faster than via Pip, but then Pip reinstalls it because Ajenti's dependencies make it think it's the wrong version.\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim -a py-libxml2 -p ajenti\n```\n\n#### Build-Time Dependencies\nBuild-time Alpine package dependencies (such as compile headers) can be installed by the `-b` switch, or a `build-requirements.txt` file. They will be removed after the dependencies are installed to save space.\n\nIf the file is at `/build-requirements.txt` it will be automatically read for dependencies. If not, use the `-B` switch to specify a file.\n\n`build-base`, `linux-headers` and `python-dev` are always build dependencies, you don't need to include them.\n```shell\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim \\\n  -p gevent \\\n  -p libxml2 \\\n  -b libxslt-dev \\\n  -b libxml-dev \\\n  -- python hello.py\n```\n\n#### Creating Images\nSimilar to the onbuild images, dependencies can be baked into a new image by using a custom `Dockerfile`, e.g:\n```dockerfile\nFROM hhftechnology/alpine-python:2.7-slim\nRUN /entrypoint.sh \\\n  -p ajenti-panel \\\n  -p ajenti.plugin.dashboard \\\n  -p ajenti.plugin.settings \\\n  -p ajenti.plugin.plugins \\\n  -b libxml2-dev \\\n  -b libxslt-dev \\\n  -b libffi-dev \\\n  -b openssl-dev \\\n\u0026\u0026 echo\nCMD [\"ajenti-panel\"]\n# you won't be able to add more dependencies later though-- see 'Debugging'\n```\n\n#### Debugging\nThe `/entrypoint.sh` script that manages dependencies in the slim images creates an empty file, `/requirements.installed`, telling the script not to install any dependencies after the container's first run. Removing this file will allow the script to work again if it is needed.\n\nYou can use the `-x` flag to see everything the `/entrypoint.sh` script is doing.\n\nYou can also access `bash` inside the container:\n```shell\ndocker run --rm -ti hhftechnology/alpine-python:2.7-slim bash\n```\n\n#### Additional Arguments\n\n`-q`: silences output from `/entrypoint.sh`\n`-x`: turns on Bash debugging, making the output very verbose.\n\n## Ecosystem\n\nThese are some of the images that use `hhftechnology/alpine-python` as base image. *If you have another image that uses this as base image, please submit an issue or PR for it to be added. Image has to be published on Docker Hub.*\n\n- **[hhftechnology/alscipy](https://github.com/hhftechnology/docker-alscipy)** [![Docker Stars](https://img.shields.io/docker/stars/hhftechnology/alscipy.svg)][alscipy-hub] [![Docker Pulls](https://img.shields.io/docker/pulls/hhftechnology/alscipy.svg)][alscipy-hub] : image with common packages for Science in Alpine Python.\n- **[hhftechnology/pywfm](https://github.com/hhftechnology/docker-pywfm)** [![Docker Stars](https://img.shields.io/docker/stars/hhftechnology/pywfm.svg)][pywfm-hub] [![Docker Pulls](https://img.shields.io/docker/pulls/hhftechnology/pywfm.svg)][pywfm-hub] : image from the python wrapper for Steffen Rendle's factorization machines library libFM.\n- **[bismuthfoundation/Bismuth-Docker](https://github.com/bismuthfoundation/Bismuth-Docker)** [![Docker Stars](https://img.shields.io/docker/stars/eggdrasyl/bismuth-node.svg)][busmuth-hub] [![Docker Pulls](https://img.shields.io/docker/pulls/eggdrasyl/bismuth-node.svg)][busmuth-hub] : node and associated services, from scratch crypto-currency with Python codebase.\n\n## Contribution\nFeel free to contribute with whatever you feel like this image is missing. There is also some changes that happen often like, updating Alpine or Python versions. Do not forget that this repo folders mirror **Python** version and **_not_** Alpine versions.\n\n## License\nThe code in this repository, unless otherwise noted, is MIT licensed. See the `LICENSE` file in this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhftechnology%2Falpine-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhftechnology%2Falpine-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhftechnology%2Falpine-python/lists"}