Python runtime Dockerfile for trusted automated Docker builds.
This repository contains Dockerfile of Python runtime for Docker’s automated build published to the public Docker Hub Registry.
This image is a base image that makes it easy to dockerize standard Python application.
It can automatically bundle a Python application with its dependencies and set the default command with no additional Dockerfile instructions.
This project heavily borrowed code from Google’s google/python-runtime Docker image.
Install Docker.
Download automated build from public Docker Hub Registry: docker pull dockerfile/python-runtime
(alternatively, you can build an image from Dockerfile: docker build -t="dockerfile/python-runtime" github.com/dockerfile/python-runtime)
This image assumes that your application:
requirements.txt file to specify its dependencies.main.py script as entrypoint or defines CMD ["/env/bin/python", "/app/<custom-entry-file>.py"] in its Dockerfile.8080.When building your application docker image, ONBUILD triggers:
/env directory in the container.requirements.txt into the virtualenv using pip install and leverage docker caching appropriately./app directory in the containerPython application directory with the following content: FROM dockerfile/python-runtime
docker build -t="app" .
8080: APP=$(docker run -d -p 8080 app)
PORT=$(docker port $APP 8080 | awk -F: '{print $2}')
echo "Open http://localhost:$PORT/"