-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 1.99 KB
/
ci-python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Docker image (Python)
on:
push:
branches:
- master
paths:
- '**/ci-python.yml'
- 'python.Dockerfile'
- 'python.entrypoint.sh'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }}
strategy:
fail-fast: false
matrix:
python_version: [3.8.20, 3.9.21, 3.10.16, 3.11.11, 3.12.8, 3.13.1]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up QEMU
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract first two elements
id: extract
run: |
str="${{ matrix.python_version }}"
IFS='.' read -ra arr <<< "$str"
result="${arr[0]}.${arr[1]}"
echo "::set-output name=result::$result"
- name: Build and push
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
PYTHON_VERSION_SHORT=${{ steps.extract.outputs.result }}
context: .
file: python.Dockerfile
platforms: linux/amd64, linux/arm64
push: true
tags: "djoh/all-in-one:python${{ steps.extract.outputs.result }}"
cache-from: type=registry,ref=djoh/all-in-one:buildcache_python${{ matrix.python_version }}
cache-to: type=registry,ref=djoh/all-in-one:buildcache_python${{ matrix.python_version }},mode=max