Skip to content

Commit 32e0496

Browse files
committed
feat: update 3.13 and 3.14 to use trixie as base image
1 parent ef0a041 commit 32e0496

6 files changed

Lines changed: 103 additions & 19 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Rebuild 3.13 On Upstream Update
2+
3+
on:
4+
schedule:
5+
- cron: "0 2 */7 * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
rebuild-if-upstream-changed:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Install skopeo
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y skopeo
23+
24+
- name: Read latest upstream digest
25+
id: latest
26+
run: |
27+
set -euo pipefail
28+
digest="$(skopeo inspect --format '{{.Digest}}' docker://python:3.13-slim-bookworm)"
29+
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
30+
31+
- name: Read stored digest
32+
id: stored
33+
run: |
34+
set -euo pipefail
35+
file=".github/state/python-3.13-slim-bookworm.digest"
36+
if [ -f "$file" ]; then
37+
echo "digest=$(cat "$file")" >> "$GITHUB_OUTPUT"
38+
else
39+
echo "digest=" >> "$GITHUB_OUTPUT"
40+
fi
41+
42+
- name: Print digest comparison
43+
run: |
44+
echo "latest: ${{ steps.latest.outputs.digest }}"
45+
echo "stored: ${{ steps.stored.outputs.digest }}"
46+
47+
- name: Login to Docker Hub
48+
if: steps.latest.outputs.digest != steps.stored.outputs.digest
49+
run: |
50+
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
51+
52+
- name: Build and push 3.13 images
53+
if: steps.latest.outputs.digest != steps.stored.outputs.digest
54+
run: |
55+
set -euo pipefail
56+
bash ./build-and-push-3_13.sh
57+
58+
- name: Persist latest digest
59+
if: steps.latest.outputs.digest != steps.stored.outputs.digest
60+
run: |
61+
set -euo pipefail
62+
mkdir -p .github/state
63+
echo "${{ steps.latest.outputs.digest }}" > .github/state/python-3.13-slim-bookworm.digest
64+
65+
git config user.name "github-actions[bot]"
66+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
67+
git add .github/state/python-3.13-slim-bookworm.digest
68+
git commit -m "chore: track python 3.13 slim-bookworm digest" || exit 0
69+
git push
70+
71+
- name: Skip build when unchanged
72+
if: steps.latest.outputs.digest == steps.stored.outputs.digest
73+
run: echo "Upstream python:3.13-slim-bookworm digest unchanged. Skipping build."

.github/workflows/rebuild-3_14-on-upstream-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Rebuild 3.14 On Upstream Update
22

33
on:
44
schedule:
5-
- cron: "0 */6 * * *"
5+
- cron: "0 0 */7 * *"
66
workflow_dispatch:
77

88
permissions:

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
ARG PYTHON_VERSION=3.11
2+
ARG DEBIAN_VERSION=bookworm
23

34
#
45
# Base image
56
#
6-
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
7+
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_VERSION} AS base
78

89
ARG DOCKER_USER=bob
910
ARG DOCKER_GROUP=bob

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ Docker images used for ZCS Python applications.
44

55
Supported python versions:
66

7-
- `3.11`
8-
- `3.12`
9-
- `3.13`
10-
- `3.14`
7+
| Version | Debian base |
8+
|---------|-------------|
9+
| `3.11` | `bookworm` |
10+
| `3.12` | `bookworm` |
11+
| `3.13` | `trixie` |
12+
| `3.14` | `trixie` |
13+
14+
Note: Python 3.11 and 3.12 are based on Debian Bookworm (stable). Python 3.13 and 3.14 are based on Debian Trixie (testing), which is required because the official `python:3.13-slim-bookworm` and `python:3.14-slim-bookworm` images are not available upstream.
1115

1216
Supported torch versions:
1317

@@ -188,6 +192,8 @@ Docker Hub page:
188192

189193
https://hub.docker.com/r/zcscompany/python
190194

195+
Refer to the Docker Hub page for the complete and up-to-date list of available image tags, as not all version combinations listed in this README may have a published image.
196+
191197
In most cases you can use these images directly in your application Dockerfiles (for example `FROM zcscompany/python:3.11-dist`) without rebuilding this repository locally.
192198

193199
This is useful when you want:

build-and-push-3_13.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
#!/bin/bash
22

33
PUSH="--push"
4+
DEBIAN_VERSION=trixie
5+
PYTHON_VERSION=3.13
46

57
set -eux
68

79
docker buildx create --name container --driver=docker-container default || true
810

9-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target base --build-arg PYTHON_VERSION=3.13 -t zcscompany/python:3.13-base .
11+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target base --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-base .
1012

11-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dev --build-arg PYTHON_VERSION=3.13 -t zcscompany/python:3.13-dev .
13+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dev --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-dev .
1214

13-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dist --build-arg PYTHON_VERSION=3.13 -t zcscompany/python:3.13-dist .
15+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dist --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-dist .
1416

15-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.13 --build-arg TORCH_VERSION=2.6.0 -t zcscompany/python:3.13-torch-cpu-2.6.0 .
17+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.6.0 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.6.0 .
1618

17-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.13 --build-arg TORCH_VERSION=2.7.0 -t zcscompany/python:3.13-torch-cpu-2.7.0 .
19+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.7.0 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.7.0 .
1820

19-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.13 --build-arg TORCH_VERSION=2.8.0 -t zcscompany/python:3.13-torch-cpu-2.8.0 .
21+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.8.0 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.8.0 .
2022

21-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.13 --build-arg TORCH_VERSION=2.9.0 -t zcscompany/python:3.13-torch-cpu-2.9.0 .
23+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.9.0 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.9.0 .
2224

23-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.13 --build-arg TORCH_VERSION=2.9.1 -t zcscompany/python:3.13-torch-cpu-2.9.1 .
25+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.9.1 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.9.1 .
2426

2527
docker buildx stop container

build-and-push-3_14.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/bin/bash
22

33
PUSH="--push"
4+
DEBIAN_VERSION=trixie
5+
PYTHON_VERSION=3.14
46

57
set -eux
68

79
docker buildx create --name container --driver=docker-container default || true
810

9-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target base --build-arg PYTHON_VERSION=3.14 -t zcscompany/python:3.14-base .
11+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target base --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-base .
1012

11-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dev --build-arg PYTHON_VERSION=3.14 -t zcscompany/python:3.14-dev .
13+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dev --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-dev .
1214

13-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dist --build-arg PYTHON_VERSION=3.14 -t zcscompany/python:3.14-dist .
15+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target dist --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} -t zcscompany/python:${PYTHON_VERSION}-dist .
1416

15-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.14 --build-arg TORCH_VERSION=2.9.0 -t zcscompany/python:3.14-torch-cpu-2.9.0 .
17+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.9.0 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.9.0 .
1618

17-
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=3.14 --build-arg TORCH_VERSION=2.9.1 -t zcscompany/python:3.14-torch-cpu-2.9.1 .
19+
docker buildx build --platform linux/amd64,linux/arm64 --sbom=true --provenance=true --builder=container --pull ${PUSH} --target torch-cpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg DEBIAN_VERSION=${DEBIAN_VERSION} --build-arg TORCH_VERSION=2.9.1 -t zcscompany/python:${PYTHON_VERSION}-torch-cpu-2.9.1 .
1820

1921
docker buildx stop container

0 commit comments

Comments
 (0)