2022-03-30 01:07:12 +02:00
|
|
|
name: Build and Publish Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
main:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: actions/checkout@v4
|
2022-03-30 01:07:12 +02:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-03-30 01:07:12 +02:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-03-30 01:07:12 +02:00
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: docker/login-action@v3
|
2022-03-30 01:07:12 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2022-03-30 16:40:02 +02:00
|
|
|
- name: Get Variables
|
|
|
|
id: get-variables
|
|
|
|
run: |
|
|
|
|
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
|
|
|
|
echo ::set-output name=gh-username-lower::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
2022-03-30 01:07:12 +02:00
|
|
|
|
|
|
|
- name: Build and push Image
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: docker/build-push-action@v5
|
2022-03-30 01:07:12 +02:00
|
|
|
with:
|
2023-01-15 18:14:04 +01:00
|
|
|
file: ./docker/Dockerfile
|
2022-12-11 06:55:27 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-01-23 17:09:53 +01:00
|
|
|
tags: ${{ steps.get-variables.outputs.gh-username-lower }}/libretranslate:${{ env.TAG }}
|
2022-03-30 01:07:12 +02:00
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
env:
|
2022-03-30 16:40:02 +02:00
|
|
|
TAG: ${{ startsWith(github.ref, 'refs/tags/') && steps.get-variables.outputs.version || 'latest' }}
|
2023-04-02 19:03:06 +02:00
|
|
|
|
|
|
|
- name: Build and push Cuda Image
|
2023-10-19 21:26:57 +02:00
|
|
|
uses: docker/build-push-action@v5
|
2023-04-02 19:03:06 +02:00
|
|
|
with:
|
|
|
|
file: ./docker/cuda.Dockerfile
|
2023-04-03 10:40:28 +02:00
|
|
|
platforms: linux/amd64
|
2023-04-02 19:03:06 +02:00
|
|
|
tags: ${{ steps.get-variables.outputs.gh-username-lower }}/libretranslate:${{ env.TAG }}-cuda
|
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
env:
|
|
|
|
TAG: ${{ startsWith(github.ref, 'refs/tags/') && steps.get-variables.outputs.version || 'latest' }}
|