From 6e04c88308886f01140df1474630dfe38e284e4e Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:21:17 +0100 Subject: [PATCH 01/18] mover scripts in a scripts dir --- compile_locales.py => scripts/compile_locales.py | 0 install_models.py => scripts/install_models.py | 0 run.bat => scripts/run.bat | 6 +++--- run.sh => scripts/run.sh | 0 suggestions-to-jsonl.py => scripts/suggestions-to-jsonl.py | 0 update_locales.py => scripts/update_locales.py | 0 6 files changed, 3 insertions(+), 3 deletions(-) rename compile_locales.py => scripts/compile_locales.py (100%) rename install_models.py => scripts/install_models.py (100%) rename run.bat => scripts/run.bat (89%) rename run.sh => scripts/run.sh (100%) rename suggestions-to-jsonl.py => scripts/suggestions-to-jsonl.py (100%) rename update_locales.py => scripts/update_locales.py (100%) diff --git a/compile_locales.py b/scripts/compile_locales.py similarity index 100% rename from compile_locales.py rename to scripts/compile_locales.py diff --git a/install_models.py b/scripts/install_models.py similarity index 100% rename from install_models.py rename to scripts/install_models.py diff --git a/run.bat b/scripts/run.bat similarity index 89% rename from run.bat rename to scripts/run.bat index d83c78b..989a212 100644 --- a/run.bat +++ b/scripts/run.bat @@ -11,7 +11,7 @@ IF NOT "%1"=="" ( SHIFT ) IF "%1"=="--help" ( - echo Usage: run.bat [--port N] + echo Usage: scripts/run.bat [--port N] echo: echo Run LibreTranslate using docker. echo: @@ -33,9 +33,9 @@ docker run -ti --rm -p %LT_PORT%:%LT_PORT% %DB_VOLUME% -v lt-local:/home/libretr GOTO :done :install_docker -ECHO Cannot find docker! Go to https://docs.docker.com/desktop/install/windows-install/ and install docker before running this script (pressing Enter will open the page) +ECHO Cannot find docker! Go to https://docs.docker.com/desktop/install/windows-install/ and install docker before running this script (pressing Enter will open the page) pause start "" https://docs.docker.com/desktop/install/windows-install/ GOTO :done -:done \ No newline at end of file +:done diff --git a/run.sh b/scripts/run.sh similarity index 100% rename from run.sh rename to scripts/run.sh diff --git a/suggestions-to-jsonl.py b/scripts/suggestions-to-jsonl.py similarity index 100% rename from suggestions-to-jsonl.py rename to scripts/suggestions-to-jsonl.py diff --git a/update_locales.py b/scripts/update_locales.py similarity index 100% rename from update_locales.py rename to scripts/update_locales.py From 5ea18f88db90ed310390eb51f2fc5423e31ced24 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:23:13 +0100 Subject: [PATCH 02/18] move dockerfile in a .docker --- Dockerfile => .docker/Dockerfile | 2 +- docker/Dockerfile.cuda => .docker/cuda.Dockerfile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename Dockerfile => .docker/Dockerfile (96%) rename docker/Dockerfile.cuda => .docker/cuda.Dockerfile (87%) diff --git a/Dockerfile b/.docker/Dockerfile similarity index 96% rename from Dockerfile rename to .docker/Dockerfile index c68b1d3..5c073c7 100644 --- a/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8.14-slim-bullseye as builder +FROM python:3.10.9-slim-bullseye as builder WORKDIR /app diff --git a/docker/Dockerfile.cuda b/.docker/cuda.Dockerfile similarity index 87% rename from docker/Dockerfile.cuda rename to .docker/cuda.Dockerfile index bd94cf0..03b89b3 100644 --- a/docker/Dockerfile.cuda +++ b/.docker/cuda.Dockerfile @@ -2,7 +2,7 @@ FROM nvidia/cuda:11.2.2-devel-ubuntu20.04 ENV ARGOS_DEVICE_TYPE cuda ARG with_models=true -ARG models= +ARG models="" WORKDIR /app @@ -27,14 +27,14 @@ RUN if [ "$with_models" = "true" ]; then \ pip3 install -e .; \ # initialize the language models if [ ! -z "$models" ]; then \ - ./install_models.py --load_only_lang_codes "$models"; \ + ./scripts/install_models.py --load_only_lang_codes "$models"; \ else \ - ./install_models.py; \ + ./scripts/install_models.py; \ fi \ fi # Install package from source code -RUN pip3 install Babel==2.11.0 && python3 compile_locales.py \ +RUN pip3 install Babel==2.11.0 && python3 scripts/compile_locales.py \ && pip3 install . \ && pip3 cache purge From c18a8d48556962388f41750ef995f7fcd2b6208e Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:23:29 +0100 Subject: [PATCH 03/18] fix docker --- .dockerignore | 2 +- docker-compose.cuda.yml | 4 ++-- docker-compose.yml | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 942f938..751b8ae 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ .git* -Dockerfile +.docker .Dockerfile.swp diff --git a/docker-compose.cuda.yml b/docker-compose.cuda.yml index 4535243..84cab59 100644 --- a/docker-compose.cuda.yml +++ b/docker-compose.cuda.yml @@ -5,10 +5,10 @@ services: container_name: libretranslate-cuda build: context: . - dockerfile: docker/Dockerfile.cuda + dockerfile: .docker/cuda.Dockerfile restart: unless-stopped ports: - - 5000:5000 + - "5000:5000" deploy: resources: reservations: diff --git a/docker-compose.yml b/docker-compose.yml index bc9bbe2..69840d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,12 @@ version: "3" services: libretranslate: container_name: libretranslate - build: . + build: + context: . + dockerfile: .docker/cuda.Dockerfile restart: unless-stopped ports: - - 5000:5000 + - "5000:5000" ## Uncomment above command and define your args if necessary # command: --ssl --ga-id MY-GA-ID --req-limit 100 --char-limit 500 ## Uncomment this section and the `volumes` section if you want to backup your API keys @@ -16,4 +18,4 @@ services: # - libretranslate_api_keys:/app/db/api_keys.db # volumes: -# libretranslate_api_keys: \ No newline at end of file +# libretranslate_api_keys: From 75869e30ab35ee928381af8313bfdaed6d153c13 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:23:43 +0100 Subject: [PATCH 04/18] update references to scripts --- .github/workflows/publish-package.yml | 4 ++-- README.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index f9eb6a1..f4373e3 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -26,7 +26,7 @@ jobs: python -m pip install --upgrade pip pip install pytest flake8 pip install . - python compile_locales.py + python scripts/compile_locales.py - name: Check code style with flake8 (lint) run: | @@ -61,6 +61,6 @@ jobs: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python compile_locales.py + python scripts/compile_locales.py python setup.py sdist bdist_wheel twine upload dist/* diff --git a/README.md b/README.md index a354594..25d6ba1 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,8 @@ Then open a web browser to http://localhost:5000 ### Run with Docker -Linux/MacOS: `./run.sh [args]` -Windows: `run.bat [args]` +Linux/MacOS: `./scripts/run.sh [args]` +Windows: `scripts/run.bat [args]` Then open a web browser to http://localhost:5000 @@ -218,7 +218,7 @@ If you're using docker: Start the program with the `--update-models` argument. For example: `libretranslate --update-models` or `./run.sh --update-models`. -Alternatively you can also run the `install_models.py` script. +Alternatively you can also run the `scripts/install_models.py` script. ## Run with WSGI and Gunicorn @@ -384,7 +384,7 @@ First you need to collect data, for example from [Opus](http://opus.nlpl.eu/), t ## Localization -The LibreTranslate Web UI is available in all the languages for which LibreTranslate can translate to. It can also (roughly) [translate itself!](https://github.com/LibreTranslate/LibreTranslate/blob/main/update_locales.py) Some languages might not appear in the UI since they haven't been reviewed by a human yet. You can enable all languages by turning on `--debug` mode. +The LibreTranslate Web UI is available in all the languages for which LibreTranslate can translate to. It can also (roughly) [translate itself!](https://github.com/LibreTranslate/LibreTranslate/blob/main/scripts/update_locales.py) Some languages might not appear in the UI since they haven't been reviewed by a human yet. You can enable all languages by turning on `--debug` mode. To help improve or review the UI translations: - Go to https://hosted.weblate.org/projects/libretranslate/app/#translations. All changes are automatically pushed to this repository. From 1fd329ffd9f478d1177b34bdae95dc360bbbbe06 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:39:17 +0100 Subject: [PATCH 05/18] fix docker build --- .github/workflows/run-tests.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index eba163c..7bfc4b6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -51,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Docker build - run: docker build -t libretranslate . + run: docker build -f .docker/Dockerfile -t libretranslate . - name: Docker build with some models - run: docker build -t libretranslate --build-arg models=en,es . + run: docker build -f .docker/Dockerfile -t libretranslate --build-arg models=en,es . diff --git a/README.md b/README.md index 25d6ba1..978b603 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Then open a web browser to http://localhost:5000 ### Build with Docker ```bash -docker build [--build-arg with_models=true] -t libretranslate . +docker build -f .docker/Dockerfile [--build-arg with_models=true] -t libretranslate . ``` If you want to run the Docker image in a complete offline environment, you need to add the `--build-arg with_models=true` parameter. Then the language models are downloaded during the build process of the image. Otherwise these models get downloaded on the first run of the image/container. From 62d53e3f09f95ec75288e4a2ae61cf93b864aa08 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:42:09 +0100 Subject: [PATCH 06/18] fix docker & upgrade base to python:3.10.9-slim-bullseye --- .docker/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 5c073c7..4c3f7f0 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -19,10 +19,10 @@ RUN ./venv/bin/pip install Babel==2.11.0 && ./venv/bin/python compile_locales.py && ./venv/bin/pip install . \ && ./venv/bin/pip cache purge -FROM python:3.8.14-slim-bullseye +FROM python:3.10.9-slim-bullseye ARG with_models=false -ARG models= +ARG models="" RUN addgroup --system --gid 1032 libretranslate && adduser --system --uid 1032 libretranslate && mkdir -p /home/libretranslate/.local && chown -R libretranslate:libretranslate /home/libretranslate/.local USER libretranslate @@ -33,9 +33,9 @@ WORKDIR /app RUN if [ "$with_models" = "true" ]; then \ # initialize the language models if [ ! -z "$models" ]; then \ - ./venv/bin/python install_models.py --load_only_lang_codes "$models"; \ + ./venv/bin/python scripts/install_models.py --load_only_lang_codes "$models"; \ else \ - ./venv/bin/python install_models.py; \ + ./venv/bin/python scripts/install_models.py; \ fi \ fi From cb7a12577d893e0b70f9874c5c9eb90bb73e449f Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:42:41 +0100 Subject: [PATCH 07/18] fix new path for script in dockerfile --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 4c3f7f0..fc99af1 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -15,7 +15,7 @@ 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 compile_locales.py \ +RUN ./venv/bin/pip install Babel==2.11.0 && ./venv/bin/python scripts/compile_locales.py \ && ./venv/bin/pip install . \ && ./venv/bin/pip cache purge From 3a635564bf2c79e8057355f20565bfe79e2fe1fa Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:44:46 +0100 Subject: [PATCH 08/18] remove python 3.7 --- .github/workflows/run-tests.yml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7bfc4b6..dfbb7df 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 813a0b5..a7ef438 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( ], }, - python_requires='>=3.7.0', + python_requires='>=3.8.0', long_description=open('README.md').read(), long_description_content_type="text/markdown", install_requires=open("requirements.txt", "r").readlines(), @@ -31,7 +31,6 @@ setup( classifiers=[ "License :: OSI Approved :: GNU Affero General Public License v3 ", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10" From c812f362e62af366980b19198959a6eccc074ed4 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:48:29 +0100 Subject: [PATCH 09/18] remove useless .gitmodules --- .gitmodules | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 From 84fbd41501525efa3ed8a1e68e929dcdace1f5c0 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:50:38 +0100 Subject: [PATCH 10/18] upgrade pytest --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a7ef438..aaf2f88 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup( long_description=open('README.md').read(), long_description_content_type="text/markdown", install_requires=open("requirements.txt", "r").readlines(), - tests_require=['pytest==7.1.2'], + tests_require=['pytest==7.2.0'], setup_requires=['pytest-runner'], classifiers=[ "License :: OSI Approved :: GNU Affero General Public License v3 ", From 9eb2d34971eababa3089e65a47da0365835603d5 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:55:57 +0100 Subject: [PATCH 11/18] move ISSUE_TEMPLATE in .github directory --- ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md (100%) diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md From 74be246c7445f211eea0378130b462a9d00aae02 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 14:57:18 +0100 Subject: [PATCH 12/18] move also gunicorn_conf.py in scripts directory --- README.md | 2 +- gunicorn_conf.py => scripts/gunicorn_conf.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename gunicorn_conf.py => scripts/gunicorn_conf.py (100%) diff --git a/README.md b/README.md index 978b603..9ae548d 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,7 @@ If you use Gunicorn, make sure to create a directory for storing multiprocess da mkdir -p /tmp/prometheus_data rm /tmp/prometheus_data/* export PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus_data -gunicorn -c gunicorn_conf.py --bind 0.0.0.0:5000 'wsgi:app(metrics=True)' +gunicorn -c scripts/gunicorn_conf.py --bind 0.0.0.0:5000 'wsgi:app(metrics=True)' ``` ## Language Bindings diff --git a/gunicorn_conf.py b/scripts/gunicorn_conf.py similarity index 100% rename from gunicorn_conf.py rename to scripts/gunicorn_conf.py From d76a9a887b5d766ef265bea321acc934f2a01260 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 16:07:26 +0100 Subject: [PATCH 13/18] move run.bat & run.sh to root --- scripts/run.bat => run.bat | 0 scripts/run.sh => run.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/run.bat => run.bat (100%) rename scripts/run.sh => run.sh (100%) diff --git a/scripts/run.bat b/run.bat similarity index 100% rename from scripts/run.bat rename to run.bat diff --git a/scripts/run.sh b/run.sh similarity index 100% rename from scripts/run.sh rename to run.sh From 1803f24c190a0a4ac25999448b1e9e0d05bab496 Mon Sep 17 00:00:00 2001 From: dingedi Date: Thu, 12 Jan 2023 16:24:18 +0100 Subject: [PATCH 14/18] fix script --- scripts/suggestions-to-jsonl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/suggestions-to-jsonl.py b/scripts/suggestions-to-jsonl.py index 7878d52..6cd8e62 100755 --- a/scripts/suggestions-to-jsonl.py +++ b/scripts/suggestions-to-jsonl.py @@ -11,7 +11,7 @@ if __name__ == "__main__": type=str, nargs=1, help="Path to suggestions.db file", - default='suggestions.db' + default='db/suggestions.db' ) parser.add_argument( "--clear", From 7bef7a8a749ce4d254aee85c61d8926096a32db1 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 13 Jan 2023 10:12:26 -0500 Subject: [PATCH 15/18] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ae548d..8d2b32a 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,8 @@ Then open a web browser to http://localhost:5000 ### Run with Docker -Linux/MacOS: `./scripts/run.sh [args]` -Windows: `scripts/run.bat [args]` +Linux/MacOS: `./run.sh [args]` +Windows: `run.bat [args]` Then open a web browser to http://localhost:5000 From 230eee1490c74a2640e5d54b88397d15e6b4d865 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 13 Jan 2023 10:14:31 -0500 Subject: [PATCH 16/18] Update run.bat --- run.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.bat b/run.bat index 989a212..3e32b5f 100644 --- a/run.bat +++ b/run.bat @@ -11,7 +11,7 @@ IF NOT "%1"=="" ( SHIFT ) IF "%1"=="--help" ( - echo Usage: scripts/run.bat [--port N] + echo Usage: run.bat [--port N] echo: echo Run LibreTranslate using docker. echo: From cfe904dfe204ffbec3029808f02c30f3981c9342 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 13 Jan 2023 10:21:07 -0500 Subject: [PATCH 17/18] Allow execution of scripts even if lt package is not installed --- scripts/compile_locales.py | 1 + scripts/install_models.py | 3 +++ scripts/update_locales.py | 1 + 3 files changed, 5 insertions(+) diff --git a/scripts/compile_locales.py b/scripts/compile_locales.py index 9825237..5aff9af 100755 --- a/scripts/compile_locales.py +++ b/scripts/compile_locales.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from babel.messages.frontend import main as pybabel if __name__ == "__main__": diff --git a/scripts/install_models.py b/scripts/install_models.py index 8fbae93..d844afb 100755 --- a/scripts/install_models.py +++ b/scripts/install_models.py @@ -1,4 +1,7 @@ #!/usr/bin/env python +import sys +import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import argparse from libretranslate.init import check_and_install_models diff --git a/scripts/update_locales.py b/scripts/update_locales.py index 79dfb4e..1fd2853 100755 --- a/scripts/update_locales.py +++ b/scripts/update_locales.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import re import polib import json From 256e63f535951cf9a9a5f2fdbe5eb2d97f74a075 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 13 Jan 2023 10:24:56 -0500 Subject: [PATCH 18/18] Do not hide docker folder --- .dockerignore | 2 +- .github/workflows/run-tests.yml | 4 ++-- README.md | 2 +- docker-compose.cuda.yml | 2 +- docker-compose.yml | 2 +- {.docker => docker}/Dockerfile | 0 {.docker => docker}/cuda.Dockerfile | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename {.docker => docker}/Dockerfile (100%) rename {.docker => docker}/cuda.Dockerfile (100%) diff --git a/.dockerignore b/.dockerignore index 751b8ae..b94de4f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ .git* -.docker +docker .Dockerfile.swp diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index dfbb7df..9e59bfd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -51,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Docker build - run: docker build -f .docker/Dockerfile -t libretranslate . + run: docker build -f docker/Dockerfile -t libretranslate . - name: Docker build with some models - run: docker build -f .docker/Dockerfile -t libretranslate --build-arg models=en,es . + run: docker build -f docker/Dockerfile -t libretranslate --build-arg models=en,es . diff --git a/README.md b/README.md index 8d2b32a..1d4e3ae 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Then open a web browser to http://localhost:5000 ### Build with Docker ```bash -docker build -f .docker/Dockerfile [--build-arg with_models=true] -t libretranslate . +docker build -f docker/Dockerfile [--build-arg with_models=true] -t libretranslate . ``` If you want to run the Docker image in a complete offline environment, you need to add the `--build-arg with_models=true` parameter. Then the language models are downloaded during the build process of the image. Otherwise these models get downloaded on the first run of the image/container. diff --git a/docker-compose.cuda.yml b/docker-compose.cuda.yml index 84cab59..46dfeea 100644 --- a/docker-compose.cuda.yml +++ b/docker-compose.cuda.yml @@ -5,7 +5,7 @@ services: container_name: libretranslate-cuda build: context: . - dockerfile: .docker/cuda.Dockerfile + dockerfile: docker/cuda.Dockerfile restart: unless-stopped ports: - "5000:5000" diff --git a/docker-compose.yml b/docker-compose.yml index 69840d0..63bd509 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: libretranslate build: context: . - dockerfile: .docker/cuda.Dockerfile + dockerfile: docker/cuda.Dockerfile restart: unless-stopped ports: - "5000:5000" diff --git a/.docker/Dockerfile b/docker/Dockerfile similarity index 100% rename from .docker/Dockerfile rename to docker/Dockerfile diff --git a/.docker/cuda.Dockerfile b/docker/cuda.Dockerfile similarity index 100% rename from .docker/cuda.Dockerfile rename to docker/cuda.Dockerfile