| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is my personal base container for Docker, now with Python! Maybe you'll find it helpful too...
The container will probably not be used directly, but rather as a for building other (Docker) containers on. To do that, specify this as your base image (in your Dockerfile):
FROM ghcr.io/minchinweb/python:3.14 # ... and the rest
This packages Python 3.14. (There are previous Python versions tagged, but the base system is likely not up to date.)
You also probably want to set the UID and GID (User ID number and Group ID number). This can be done through the environmental variables PUID and GUID (either the -e option at the command line, or the environment key in your docker-compose.yaml file).
There is also a folders at /app, /config, /defaults that are owned by the user. The idea is to have your application use this /config volume for all its persist-able data, and do this by mounting this as a volume outside of your container (either the -v option at the command line, or the volumes key in your docker-compose.yaml file). /app is a logical location for the Python program you are trying to run.
or, What Problems is This Trying to Solve?
After solving the issues with user permissions and PID 1 with my base container, I wanted to keep those solutions in place for my Python Docker images.
The first thing I tried was to install Python 3.7 using apt. While there is a python3.7 package that will happily install, there is no corresponding apt package for pip (which is needed to install other Python libraries).
Next I tried to compile Python from source myself. This seemed to work, but it took over an hour. This didn't seem to the most desirable solution.
Finally, I realized I could "borrow" a pre-compiled version of Python from the official image via a "multi-stage build", using the official image as my "build stage". This seems to work, the build time is much better, although a few extra tweaks were needed.
This builds on my base image.
This also wouldn't work without the official Python image.
| Back | FazBrowse Home | New Git URL |