-
Notifications
You must be signed in to change notification settings - Fork 6
40 lines (34 loc) · 1.15 KB
/
Copy pathdocker-image.yml
File metadata and controls
40 lines (34 loc) · 1.15 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
name: Build and Push Docker Image
on:
release:
types: [published, created]
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python + toml parser
run: |
python -m pip install --upgrade pip
pip install toml
- name: Extract package version
id: vars
run: |
PACKAGE_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
PYTHON_VERSION=$(grep FROM Dockerfile | grep -oP 'python:\K[0-9]+\.[0-9]+' | tr -d '.')
FLAVOR=cpu
echo "tag=v${PACKAGE_VERSION}-py${PYTHON_VERSION}-${FLAVOR}" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: dbouget/raidionics-val:${{ steps.vars.outputs.tag }}