An Alpine Linux image configured with the basic requirements for, and an installation of pyenv.
259
The pyenv image is an Alpine Linux image configured with the basic requirements for, and an installation of pyenv (https://github.com/pyenv/pyenv).
Although the image can be used directly, it is intended to be used as a base image for creating subsequent Docker images with specific versions of Python installed.
As stated, the image is built with the expectation that it will be the basis for specific Python installations. Also, there are additional capabilities that assist in creating final application images. Each of these capabilities is driven with a script.
install-python.shinstall-python.sh is used to configure a specific version of Python. The intent is that a new image would be created from the resulting execution of this script. For example, the Dockerfile example below will build an image with Python 3.7.4 installed and the default Python installation set for the built-in user alpine.
FROM relenteny/pyenv:1.2.14
RUN /home/alpine/bin/install-python.sh 3.7.4
Typically, although not required, the resultant image would be stored in the registry as a generic Python runtime image. Using the example above, an example image name and tagged could be myregistry/python:3.7.4.
install-requirements.shinstall-requirements.sh is a convenience script that will install additional Python modules as specified through a requirements file, by convention, named requirements.txt. This script can only be executed once a version of Python has been installed. When invoked, the path to the text file containing the modules to be installed must be provided as an argument as follows:
/home/alpine/bin/install-requirements.sh /home/alpine/requirements.txt
Here requirements.txt is specified as being in the home directory of the built in user, alpine. This, of course, is dependent on how the actual Dockerfile is written. An example of its usage is below.
FROM myregistry/python:3.7.4
.
.
.
# Execute various Dockerfile commands to copy requirements text file and application code
.
.
.
RUN /home/alpine/bin/install-requirements.sh /home/alpine/requirements.txt
WORKDIR /home/alpine/app
ENTRYPOINT ["python my-application.py"]
Content type
Image
Digest
Size
85.9 MB
Last updated
about 6 years ago
docker pull relenteny/pyenv:1.2.14