Start with a clean Alpine system and build Python3+Bottle. Start by opening a Linux container in the native Linux desktop environment with the following code:

Docker run it –name bottle -p 80:80 -p 465:465 -p 9090:9090 -p 8001:8001 -p 8002:8002 -v $PWD:/ WWW alpine:3.12

1. Switch to the accelerated image software source

A. Edit /etc/apk/repositories B. “Replace” CDn.alpinelinux.org “with mirrors.aliyun.com; Save and exit. You can use the following command to replace it

sed -i ‘s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g’ /etc/apk/repositories

2. Install Python3

Bottle is a Bottle framework, so Python is required, and this time we’ll install Python3

apk add –no-cache python3 python3-dev python3-pip

In fact, we also need to install the PYTHon3-dev software library, otherwise we will get an error when we install Bottle. Also we need to install python3- PIP 3

We will use some basic toolkits when developing the program. We will install them first, otherwise there may be errors when compiling or running the program

apk add –no-cache zlib-dev bzip2-dev pcre-dev openssl-dev ncurses-dev sqlite-dev readline-dev tk-dev

4. Install the compilation tool

We will probably use a compiler to compile the source code later, so let’s install the basic compiler first

apk add –no-cache gcc g++ make cmake

5. Install easy_install

Pip3 install setuptools pip3 install setuptools

In fact, easy_install comes with the installation. When I tested it on Python3.8.1, you can use the following command to check the version of easy_install.

Easy_install – 3.8 – version

6. Install uwsgi

Apk add –no-cache Linux headers pip3 install uWSgi

Test whether uWSGi is normal:

Create a new test.py file,

Then run the following code on the terminal:

Uwsgi — HTTP :8001 –wsgi-file test.py

If “Hello World” is displayed normally, check installation procedure 7. Install the Bottle

pip3 install Bottle