include docker versioned images

This commit is contained in:
Bernat Vadell 2023-03-16 11:44:00 +01:00
parent c20281924c
commit c6b2c6fd8f

View file

@ -10,6 +10,7 @@
name: Publish Docker image name: Publish Docker image
on: on:
pull_request:
push: push:
branches: branches:
- master - master
@ -18,13 +19,23 @@ jobs:
push_to_registry: push_to_registry:
name: Push Docker image to Docker Hub name: Push Docker image to Docker Hub
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
COMMIT_SHA: ${{ github.sha }}
strategy: strategy:
matrix: matrix:
config: config:
- { tag: "latest", dockerfile: ".devops/main.Dockerfile" } - { tag: "latest", dockerfile: ".devops/main.Dockerfile" }
- { tag: "full", dockerfile: ".devops/full.Dockerfile" } - { tag: "full", dockerfile: ".devops/full.Dockerfile" }
- {
tag: "light",
dockerfile: ".devops/main.Dockerfile",
include_hash: true,
}
- {
tag: "full",
dockerfile: ".devops/full.Dockerfile",
include_hash: true,
}
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -40,12 +51,12 @@ jobs:
with: with:
registry: docker.pkg.github.com registry: docker.pkg.github.com
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image - name: Build and push Docker image (tagged)
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: true
tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}" tags: "ghcr.io/ggerganov/llama.cpp:{{ matrix.config.tag }}{{ matrix.config.include_hash && '-{{ env.COMMIT_SHA }}' || '' }}"
file: ${{ matrix.config.dockerfile }} file: ${{ matrix.config.dockerfile }}