{"id":18649529,"url":"https://github.com/ryu-cz/alpine-uwsgi-flask","last_synced_at":"2026-05-10T06:39:07.306Z","repository":{"id":99601182,"uuid":"252756698","full_name":"Ryu-CZ/alpine-uwsgi-flask","owner":"Ryu-CZ","description":"Minimal python flask uWSGI server packed in docker alpine ","archived":false,"fork":false,"pushed_at":"2020-05-27T11:40:59.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T10:07:20.047Z","etag":null,"topics":["alpine","alpine-linux","docker","flask","python","python3","uwsgi"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ryu-CZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-03T14:31:09.000Z","updated_at":"2023-08-02T08:33:39.000Z","dependencies_parsed_at":"2023-07-31T02:33:23.903Z","dependency_job_id":null,"html_url":"https://github.com/Ryu-CZ/alpine-uwsgi-flask","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryu-CZ%2Falpine-uwsgi-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryu-CZ%2Falpine-uwsgi-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryu-CZ%2Falpine-uwsgi-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ryu-CZ%2Falpine-uwsgi-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ryu-CZ","download_url":"https://codeload.github.com/Ryu-CZ/alpine-uwsgi-flask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239455980,"owners_count":19641750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","alpine-linux","docker","flask","python","python3","uwsgi"],"created_at":"2024-11-07T06:38:53.843Z","updated_at":"2025-11-05T10:30:26.873Z","avatar_url":"https://github.com/Ryu-CZ.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alpine-uwsgi-flask  \n  \nMinimal python Flask application uWSGI server packed into docker alpine container.  \n  \n\n## Motivation  \n  \nI found there could be found no functional servers examples of [docker alpine](https://hub.docker.com/_/alpine) [python](https://hub.docker.com/_/python) + [uWSGI](https://uwsgi-docs.readthedocs.io/) + [Flask](https://flask.palletsprojects.com/). So I decided to create the example on my own.  \n\n  \n\u003e Why uWSGI?   \n\nIt is really good web server. It is written with intention to be just web server, nothing more and nothing less. It is blazing fast in real life applications and well scalable with WSGI frameworks like Flask. \n  \n\u003e What else I need\n\nIt is good idea to put dedicated proxy between the Internet and your uWSGI server. Dedicated proxy is securite, fast and lightweigt. My APIs are using [Nginx](https://www.nginx.com/). It is good secure, free and open source option... also p---hub uses it so why not you?\n \n\u003e Why NOT Apache  \n  \nIt does not support WSGI and python applications by default. It is not just web server but also a load balancer, proxy and traffic monitor. This makes Apache resource hungry monoolith bad for easy scalability. \n\nExample from real life usage of uWSGI and Apache running the same REST API code written in Flask :   \n  \nHardware:  \n - CPU 4   \n - RAM 2GB  \n  \n| server | workers | CPU usage | RAM usage | Swapping | latency (ms) |  \n|--|--|--|--|--|--|\n| Apache | 12 | 100% | 100% | Yes | 1000 - 20 000 |  \n| uWSGI | 32 | 20% | 60% | No | 50-125 |    \n  \n\n## Content  \nIn the project you find these files:  \n  \n- `hello.py` - File is basic Flask project with `app` object instance inside.   \n- `requirements.txt` - Python dependencies are listed here together with your weapon of choice uWSGI \u003c3.   \n- `uwsgi.ini` - Simple uWSGI server configuration. It describes how uWSGI uses your `hello.py` so these two are closely related.  \n- `Dockerfile` - Blueprint of docker image you want to create. Files `uwsgi.ini` and `Dockerfile` depend closely on each other because they include system paths.  \n- meta files:  \n  - `.gitignore` - Files listed here are not traced by your Git.  \n  - `.dockerignore` - Files and folders listed here are ignored during docker image building. Similar function as `.gitignore` file in Git. Do not forget on this one. Otherwise your `venv` and `.git` will be included in result image!  \n  \n  \n## Build Image  \n  \nNavigate into folder with `Dockerfile`.  \n  \n```bash  \ncd ./alpine-uwsgi-flask  \n```  \n  \nUse standard `docker build` command. File `Dockerfile` in folder `.` is used as blueprint for build. Option `-t uwsgi_flask:latest` sets name of result `image`. ANd wait a moment until build is finished.  \n  \n```bash  \ndocker build -t uwsgi_flask:latest .  \n```  \n  \nVerify new image `uwsgi_flask` exist with `docker images`:  \n  \n```bash  \n$ docker images  \nREPOSITORY            TAG                 IMAGE ID            CREATED                 SIZE  \nuwsgi_flask           latest              80d6561f19c8        About a minute ago      119MB  \n```  \n  \n  \n### Result Image  \n  \nWhen you compare the base image `python:3-alpine` *(107MB)*  with new `uwsgi_flask` *(119MB)* you found that our build process is pretty lightweight.  \n  \n```bash  \n$ docker images  \nREPOSITORY            TAG                 IMAGE ID            CREATED             SIZE  \nuwsgi_flask           latest              80d6561f19c8        About a minute ago   119MB  \npython                3-alpine            d5e5ad4a4fc0        10 days ago          107MB  \n```  \n  \n\u003e You can check how many layers *(less is better)* build created and check their size with command `docker history \u003cimage\u003e`.   You can see new layers are on top and oldest on bottom. \n\n  \n## Run New Image  \n  \nFrom new image `uwsgi_flask` you can create `container` instance with command `docker run`. Option `-p 127.0.0.1:5000:5000` publishes port `5000` from container into you localhost `127.0.0.1:5000`.  \n  \n```bash  \ndocker run -d -p 127.0.0.1:5000:5000 --name wsgi uwsgi_flask  \n```  \n  \n  \nConfirm there is new running container named `wsgi` base on your image `uwsgi_flask` with command `docker ps`.  \n  \n```bash  \n$ docker ps  \nCONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                      NAMES  \nd6b97d42ba79        uwsgi_flask         \"uwsgi --ini-paste /…\"   About a minute ago   Up About a minute   127.0.0.1:5000-\u003e5000/tcp   wsgi  \n```  \n  \n  \nAnd test it:  \n  \n```bash  \n$ curl \"http://localhost:5000\"  \nHello, World!  \n```  \n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-cz%2Falpine-uwsgi-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryu-cz%2Falpine-uwsgi-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-cz%2Falpine-uwsgi-flask/lists"}