Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,51 @@ jobs:
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.13/slim-bookworm/Dockerfile
sed -i "s/3\.13\.[0-9]\+\([-a-z]*\)/$python_version\1/g" README.md

- name: Update requirements
- name: Fetch latest Python 3.14 release
if: ${{ github.event.schedule == '0 18 10 2-12/2 *' || github.event_name == 'workflow_dispatch' }}
run: |
python_version=$(curl -s https://www.python.org/ftp/python/ | grep -oP '3\.14\.\d+/' | uniq | sort -V | tail -n 1 | tr -d '/')

echo "python3.14: $python_version"

sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.14/bookworm/Dockerfile
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.14/slim-bookworm/Dockerfile
sed -i "s/3\.14\.[0-9]\+\([-a-z]*\)/$python_version\1/g" README.md

- name: Update 3.12 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.12
python-version: '3.12'

- name: Update requirements
- name: Update 3.13 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.13
python-version: '3.13'

- name: Update 3.14 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.14
python-version: '3.14'

- name: Extract package versions and update Dockerfile
run: |
pip312=$(grep '^pip==' requirements/3.12/pip.txt | cut -d'=' -f3)
pip313=$(grep '^pip==' requirements/3.13/pip.txt | cut -d'=' -f3)
pip314=$(grep '^pip==' requirements/3.14/pip.txt | cut -d'=' -f3)

echo "Extracted versions:"
echo "pip3.12: $pip312"
echo "pip3.13: $pip313"

sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip312/" 3.12/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip312/" 3.12/slim-bookworm/Dockerfile
echo "pip3.13: $pip313"
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip313/" 3.13/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip313/" 3.13/slim-bookworm/Dockerfile
echo "pip3.14: $pip314"
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip314/" 3.14/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip314/" 3.14/slim-bookworm/Dockerfile

- name: Detect changes
id: git-diff
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/publish-3.13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ jobs:
- version: '3.13'
variant: bookworm
tags: |
${{ needs.tagger.outputs.major }}
${{ needs.tagger.outputs.major-minor }}
${{ needs.tagger.outputs.version }}
- version: '3.13'
variant: slim-bookworm
tags: |
${{ needs.tagger.outputs.major }}-slim
${{ needs.tagger.outputs.major-minor }}-slim
${{ needs.tagger.outputs.version }}-slim
with:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/publish-3.14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: publish-3.14

on:
push:
branches:
- coatl
paths:
- .github/workflows/publish.yml
- .github/workflows/publish-3.14.yml
- 3.14/**
schedule:
- cron: '0 8 17 * *'

jobs:
tagger:
runs-on: ubuntu-latest
outputs:
major: ${{ steps.tags.outputs.major }}
major-minor: ${{ steps.tags.outputs.major-minor }}
version: ${{ steps.tags.outputs.version }}

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Extract version number
id: tags
run: |
# Extract the Python version from the Dockerfile
VERSION=$(grep 'ENV PYTHON_VERSION' 3.14/bookworm/Dockerfile | cut -d '=' -f 2)
echo "VERSION=${VERSION}"
# Trim the version to the first two segments (major.minor)
MAJOR_MINOR=$(echo $VERSION | cut -d'.' -f1-2)
echo "MAJOR_MINOR=${MAJOR_MINOR}"
# Trim the version to the first segment (major)
MAJOR=$(echo $VERSION | cut -d'.' -f1-1)
echo "MAJOR=${MAJOR}"
# Export the extracted version to GITHUB_OUTPUT
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT

publish:
needs: tagger
uses: ./.github/workflows/publish.yml
strategy:
matrix:
image:
- version: '3.14'
variant: bookworm
tags: |
${{ needs.tagger.outputs.major }}
${{ needs.tagger.outputs.major-minor }}
${{ needs.tagger.outputs.version }}
- version: '3.14'
variant: slim-bookworm
tags: |
${{ needs.tagger.outputs.major }}-slim
${{ needs.tagger.outputs.major-minor }}-slim
${{ needs.tagger.outputs.version }}-slim
with:
image: coatldev/python
version: ${{ matrix.image.version }}
variant: ${{ matrix.image.variant }}
tags: ${{ matrix.image.tags }}
username: ${{ vars.DOCKERHUB_USERNAME }}
secrets:
password: ${{ secrets.DOCKERHUB_TOKEN }}
118 changes: 118 additions & 0 deletions 3.14/bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
FROM buildpack-deps:bookworm

LABEL \
maintainer="César Román <cesar@coatl.dev>" \
repository="https://github.com/coatl-dev/docker-python" \
vendor="coatl.dev"

ENV DEBIAN_FRONTEND=noninteractive

ENV PIP_NO_CACHE_DIR=1
ENV PIP_ROOT_USER_ACTION=ignore

# ensure local python is preferred over distribution python
ENV PATH=/usr/local/bin:$PATH

# runtime dependencies
RUN set -eux; \
apt-get update; \
apt-get upgrade --yes; \
apt-get install -y --no-install-recommends \
libbluetooth-dev \
tk-dev \
uuid-dev \
; \
rm -rf /var/lib/apt/lists/*

ENV PYTHON_VERSION=3.14.0

RUN set -eux; \
\
wget -q -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \
mkdir -p /usr/src/python; \
tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \
rm python.tar.xz; \
\
cd /usr/src/python; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-optimizations \
--enable-option-checking=fatal \
--enable-shared \
--with-lto \
--without-ensurepip \
; \
nproc="$(nproc)"; \
EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
make -j "$nproc" \
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
"LDFLAGS=${LDFLAGS:-}" \
; \
# https://github.com/docker-library/python/issues/784
# prevent accidental usage of a system installed libpython of the same version
rm python; \
make -j "$nproc" \
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
"LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \
python \
; \
make install; \
\
# enable GDB to load debugging data: https://github.com/docker-library/python/pull/701
bin="$(readlink -ve /usr/local/bin/python3)"; \
dir="$(dirname "$bin")"; \
mkdir -p "/usr/share/gdb/auto-load/$dir"; \
cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \
\
cd /; \
rm -rf /usr/src/python; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
\) -exec rm -rf '{}' + \
; \
\
ldconfig; \
\
export PYTHONDONTWRITEBYTECODE=1; \
python3 --version

# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends)
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -eux; \
for src in idle3 pydoc3 python3 python3-config; do \
dst="$(echo "$src" | tr -d 3)"; \
[ -s "/usr/local/bin/$src" ]; \
[ ! -e "/usr/local/bin/$dst" ]; \
ln -svT "$src" "/usr/local/bin/$dst"; \
done

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION=25.2
# https://github.com/pypa/get-pip
ENV PYTHON_GET_PIP_URL=https://raw.githubusercontent.com/pypa/get-pip/HEAD/public/get-pip.py

RUN set -eux; \
\
wget -q -O get-pip.py "$PYTHON_GET_PIP_URL"; \
\
export PYTHONDONTWRITEBYTECODE=1; \
\
python get-pip.py \
--disable-pip-version-check \
--no-compile \
"pip==$PYTHON_PIP_VERSION" \
--no-setuptools \
--no-wheel \
; \
rm -f get-pip.py; \
\
pip --version

CMD ["python3"]
Loading