Skip to content

luisprox/docker-python-flask-hello-world

Repository files navigation

Hello, World (Docker/Python/Flask)

Sample flask webserver using docker container in linux.

Running standalone python

Installation

$ sudo apt update && sudo apt full-upgrade
$ sudo apt install python3 pip3

Run using Makefile

$ make init
$ make run

Note: windows version make.bat was not tested.

Running inside Docker Container

Installation

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
# Add your-user to docker group to run without sudo
$ sudo usermod -aG docker your-user

Run using Makefile

$ make build-docker
$ make run-docker

Note: make docker configured for linux only.

Customization parameters

Example using different python container with different webserver port

$ make build-docker REP_TAG=3.9-slim-buster APP_PORT=4040
$ make run-docker APP_PORT=4040

See Makefile for more customizations.

License

Licensed under MIT. Please see LICENSE for details.

Recommended reads

Structure your repository

Simple Python Project Structure

Sample Python Project

Sample Flask Project

Dockerfile Best Practices

Use ARG and ENV variables in Dockerfile CMD

About

Sample flask webserver using docker container in linux

Resources

License

Stars

Watchers

Forks

Packages

No packages published