mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-30 16:47:19 +00:00
* Fix docker tag with semantic version for releases * Prepend latest docker tag with tagprefix in cache-from
69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
name: docker-build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
timeout-minutes: 45
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- dockerfile: Dockerfile
|
|
repository: deepset/haystack-cpu
|
|
tagprefix: ''
|
|
default: true
|
|
|
|
- dockerfile: Dockerfile-GPU
|
|
repository: deepset/haystack-gpu
|
|
tagprefix: 'demo-'
|
|
default: true
|
|
|
|
- dockerfile: Dockerfile-GPU-minimal
|
|
repository: deepset/haystack-gpu
|
|
tagprefix: 'minimal-'
|
|
default: false
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ matrix.repository }}
|
|
tags: |
|
|
type=semver,pattern={{version}},prefix=${{ matrix.tagprefix }}
|
|
type=sha,format=long,prefix=${{ matrix.tagprefix }}
|
|
type=sha,format=long,prefix=,enable=${{ matrix.default }}
|
|
type=raw,value=latest,prefix=${{ matrix.tagprefix }}
|
|
type=raw,value=latest,prefix=,enable=${{ matrix.default }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USER }}
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
- name: Build and push docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
file: ${{ matrix.dockerfile }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
push: true
|
|
cache-from: type=registry,ref=${{ matrix.repository }}:${{ matrix.tagprefix }}latest
|
|
cache-to: type=inline
|