-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (64 loc) · 2.69 KB
/
docker-build.yml
File metadata and controls
73 lines (64 loc) · 2.69 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
name: Build and Push Docker Images
on:
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract Python version from release
id: extract_version
run: |
# Extract version from GitHub release tag (assuming format like "3.10" or "v3.10")
VERSION="${{ github.event.release.tag_name }}"
# Remove 'v' prefix if present
PYTHON_VERSION="${VERSION#v}"
echo "python_version=${PYTHON_VERSION}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Build and push regular variant
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-regular
push: true
tags: mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}
build-args: |
PYTHON_VERSION=${{ steps.extract_version.outputs.python_version }}
platforms: linux/amd64,linux/arm64
- name: Build and push slim variant
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-slim
push: true
tags: mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}-slim
build-args: |
PYTHON_VERSION=${{ steps.extract_version.outputs.python_version }}
platforms: linux/amd64,linux/arm64
- name: Build and push lite variant
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-lite
push: true
tags: mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}-lite
build-args: |
PYTHON_VERSION=${{ steps.extract_version.outputs.python_version }}
platforms: linux/amd64,linux/arm64
- name: Update release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.event.release.tag_name }}
body: |
Docker images available at: https://hub.docker.com/r/mantissoftware/python-runner/tags
- mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}
- mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}-slim
- mantissoftware/python-runner:${{ steps.extract_version.outputs.python_version }}-lite