-
Notifications
You must be signed in to change notification settings - Fork 5
104 lines (91 loc) · 3.49 KB
/
_docker-publish.yml
File metadata and controls
104 lines (91 loc) · 3.49 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: "> Docker Publish"
on:
workflow_call:
secrets:
DOCKER_USERNAME:
required: false
DOCKER_PASSWORD:
required: false
jobs:
docker_publish:
runs-on: ubuntu-latest
permissions:
attestations: write
contents: read
id-token: write
packages: write
env:
DOCKER_IO_REGISTRY: docker.io
DOCKER_IO_IMAGE_NAME_ALL: helmuthva/aignostics-python-sdk
DOCKER_IO_IMAGE_NAME_SLIM: helmuthva/aignostics-python-sdk-slim
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dev tools
shell: bash
run: .github/workflows/_install_dev_tools.bash
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to GitHub container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "(all target): Extract metadata (tags, labels) for Docker"
id: meta-all
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
${{ env.DOCKER_IO_IMAGE_NAME_ALL }}
ghcr.io/${{ github.repository }}
tags: |
# set latest tag for releases
type=raw,value=latest
# set semver tags from git tags (v1.2.3 -> 1.2.3, 1.2, 1)
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: "(slim target): Extract metadata (tags, labels) for Docker"
id: meta-slim
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: |
${{ env.DOCKER_IO_IMAGE_NAME_SLIM }}
ghcr.io/${{ github.repository }}-slim
tags: |
# set latest tag for releases
type=raw,value=latest
# set semver tags from git tags (v1.2.3 -> 1.2.3, 1.2, 1)
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: "(all target): Build and push Docker image"
id: build-and-push-all
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./Dockerfile
target: all
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-all.outputs.tags }}
labels: ${{ steps.meta-all.outputs.labels }}
- name: "(slim target): Build and push Docker image"
id: build-and-push-slim
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./Dockerfile
target: slim
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-slim.outputs.tags }}
labels: ${{ steps.meta-slim.outputs.labels }}