From a59aaff57b4da5655a2502d3e5400400fff47494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20T?= Date: Sun, 2 Apr 2023 18:58:11 +0200 Subject: [PATCH 1/3] upgrade image --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fc99af1..fc9f651 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.9-slim-bullseye as builder +FROM python:3.10.10-slim-bullseye as builder WORKDIR /app @@ -19,7 +19,7 @@ RUN ./venv/bin/pip install Babel==2.11.0 && ./venv/bin/python scripts/compile_lo && ./venv/bin/pip install . \ && ./venv/bin/pip cache purge -FROM python:3.10.9-slim-bullseye +FROM python:3.10.10-slim-bullseye ARG with_models=false ARG models="" From 4dc7372a20d28b75a5a3c499acfb43f6e31322c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20T?= Date: Sun, 2 Apr 2023 18:58:43 +0200 Subject: [PATCH 2/3] upgrade Babel & install torch without nvidia cuda --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fc9f651..a988e3d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,8 @@ RUN python -mvenv venv && ./venv/bin/pip install --upgrade pip COPY . . # Install package from source code, compile translations -RUN ./venv/bin/pip install Babel==2.11.0 && ./venv/bin/python scripts/compile_locales.py \ +RUN ./venv/bin/pip install Babel==2.12.1 && ./venv/bin/python scripts/compile_locales.py \ + && ./venv/bin/pip install torch --extra-index-url https://download.pytorch.org/whl/cpu \ && ./venv/bin/pip install . \ && ./venv/bin/pip cache purge From ac3cdb80dbd4490d637ea87e5c669f57690c093a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20T?= Date: Sun, 2 Apr 2023 19:03:06 +0200 Subject: [PATCH 3/3] build and push image with cuda support --- .github/workflows/publish-docker.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 04a188e..8a63a19 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -43,3 +43,15 @@ jobs: cache-to: type=gha,mode=max env: TAG: ${{ startsWith(github.ref, 'refs/tags/') && steps.get-variables.outputs.version || 'latest' }} + + - name: Build and push Cuda Image + uses: docker/build-push-action@v2 + with: + file: ./docker/cuda.Dockerfile + platforms: linux/amd64,linux/arm64 + 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' }}