A simple Python 3 in a docker Alpine linux multi-arch container image completed by Bottle and Requests libraries that serves to run web python apps easily (Total size of the container: ).
Pre-build as multi-arch image from Docker hub with "automated build" option.
image name d3fk/python_in_bottle
docker pull d3fk/python_in_bottle
Docker hub repository: https://hub.docker.com/r/d3fk/python_in_bottle/
This image is provided with 3 TAGS wich are all multi-arch images:
- d3fk/python_in_bottle:latest: is a multi-arch image that is regularly updated for python 3 and Alpine linux versions including packages & security fixes.
- d3fk/python_in_bottle:stable: is a multi-arch image with fixed versions, i.e. python 3.11 in an Alpine 3.17. This image had a stable behaviour observed in production, so that it was freezed in a release of the code repo and built from the Docker hub by automated build. It won't be changed or rebuilt in the future (the code is available from the "releases" section of this image code repository on GitHub).
- d3fk/python_in_bottle:gcc: is a multi-arch image that corresponds to the "latest" image + gcc and libc packages installed for those who need them as build dependencies. It is regularly updated for python 3 and Alpine linux versions including packages & security fixes.
These multi-arch images will fit most of architectures:
- linux/amd64
- linux/386
- linux/arm/v6
- linux/arm/v7
- linux/arm64/v8
- linux/ppc64le
- linux/s390x
For example, if you need to run a web app you could use it this way:
docker run -itd -p 80:80 -v $(pwd)/myapp:/usr/src/myapp -w /usr/src/myapp d3fk/python_in_bottle:latest python your-python-script.py
Then go to your browser at http://localhost to see your web app running
Here is a small "Hello World" example using the Bottle Web Framework
from bottle import route, run
@route('/')
def hello():
return "Hello World!"
run(host='0.0.0.0', port=80, debug=True)
More details on the Bottle Web Framework here: https://bottlepy.org
More details on the Requests python library here: http://docs.python-requests.org
The content of this GitHub code repository is provided under MIT licence . For the embeded libraries and packages please see the related licenses information on their respective official repositories.