Skip to content

moppermonster/alpine-python-falcon

Repository files navigation

alpine-python-falcon

Alpine based Falcon and friends image

About

Alpine based docker image with Python3 including Falcon, NGINX, uWSGI and Supervisord.

Docker Hub

moppermonster/alpine-python-falcon

Docker Hub

Usage

Build your own image

FROM moppermonster/alpine-python-falcon

COPY app.py /app.py

CMD ["/usr/bin/supervisord"]

Mount your own files

An alternative to building your own container is mounting files over existing locations in the container.

Interesting files and their locations (in the container):

File Description
/app.py Main app, an example is provided with this repository
/middleware.py Falcon middleware, this image comes with json middleware by default
/static/ Static directory, by default NGINX is configured to deliver static content from this location
/etc/nginx/nginx.conf NGINX config file
/etc/nginx/conf.d/falcon-site-nginx.conf NGINX config extension, static can be configured from here
/etc/uwsgi/uwsgi.ini UWSGI config file
/etc/supervisord.conf Supervisord config file

docker-compose

Mounting files is considerably easier using docker-compose. This repository contains some examples.

Examples

This repository contains some examples using the image.

Dockerfile

FROM moppermonster/alpine-python

# Install friends
RUN apk add --no-cache nginx uwsgi uwsgi-python3 supervisor

# Install Falcon
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt

# Clean up
RUN rm /etc/nginx/conf.d/default.conf
RUN rm -r /root/.cache

# Config files
COPY nginx.conf /etc/nginx/
COPY flask-site-nginx.conf /etc/nginx/conf.d/
COPY uwsgi.ini /etc/uwsgi/
COPY supervisord.conf /etc/supervisord.conf

# Falcon json middleware
COPY middleware.py /middleware.py

# Prepare static directory
RUN mkdir /static

# Copy default app.py
COPY app.py /app.py

CMD ["/usr/bin/supervisord"]

Building

rebuild.sh

Simply use rebuild.sh

sh rebuild.sh

Default port: http://localhost:5678

Manually

Build

docker build -t alpine-python-falcon .

Run

docker run -p 5678:80 alpine-python-falcon

Credits, thanks and background

Releases

No releases published

Packages

No packages published