1 min read

Python OpenSUSE Leap Image

This Dockerfile is a simple build for a WSGI app (This one is Django)

FROM opensuse/leap:15.5

RUN zypper --non-interactive si -d python311 python311-pip \
    && zypper --non-interactive in python311 \
    && python3.11 -m ensurepip

COPY requirements.txt /requirements.txt

RUN python3.11 -m pip install -r /requirements.txt

WORKDIR /app

COPY . .

EXPOSE 8000

CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app.wsgi"]

I strongly suggest having a proxy in front, and not exposing 0.0.0.0 except during development

Notes:

The reason I like using OpenSUSE is the continuous upgrades and security patches on my laptop and servers. I love having the same OS on my Laptop and my Servers to make my life easier during development. Altho I use Tumbleweed on my machines, I found that they only provide a leap image for Docker, which makes sense as it does not require the same model (as long as the security scans pass, new packages are not necessarily needed as fast as on a development machine)

At the time of writing, python312 is already available (which has some major features for typing) I did not test yet but should be the same as above

Have fun Dockerizing!