longwuyuan / jenkins-kubernetes-podman

A Python dockerized hello world app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a example of building docker images in following use-case

  • Jenkins master running as a pod in kubernetes
  • Jenkins agent launched as a pod in kubernetes
  • Needing to build a docker image
  • Not running the agent pod in privileged mode

One issue exists containers/podman#8190

docker-python-helloworld

A Python dockerized hello world app This repo aims at showing how simple it can be to build a Docker container running a Python (very simple) app. Once you understand how this simple example works, it's easy to apply it to bigger apps.

Steps to run directly the python code

It's highly recommended to install the (empty) dependencies in a virtual environment.

  • Creating the virtual environment:
virtualenv venv
  • Activating the virtual environment:
source venv/bin/activate
  • Installing dependencies:
pip install -r requirements.txt
  • Running the code:
python main.py

Steps to run the python code within a Docker container

  • Build the image:
docker build -t docker-python-helloworld:lastest
  • Run the container:
docker run docker-python-helloworld:latest 

About

A Python dockerized hello world app


Languages

Language:Dockerfile 79.8%Language:Python 20.2%