From e2841ddc197b3d838a80fad3a73270543b10aec5 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 4 Jul 2023 09:42:58 +0200 Subject: [PATCH] Update CONTRIBUTING.md --- CONTRIBUTING.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee04f2a..9621360 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,51 @@ sudo apt-get install cmake sudo dnf install cmake ``` +## Getting Started + +```bash +git clone https://github.com/LibreTranslate/LibreTranslate.git +cd LibreTranslate +pip install -e . +libretranslate [args] + +# Or +python main.py [args] +``` + +Then open a web browser to + +## Run with Docker + +Linux/macOS: `./run.sh [args]` +Windows: `run.bat [args]` + +Then open a web browser to + +## Build with Docker + +```bash +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. + +Run the built image: + +```bash +docker run -it -p 5000:5000 libretranslate [args] +``` + +Or build and run using Docker Compose: + +```bash +docker compose up -d --build +``` + +> Feel free to change the [`docker-compose.yml`](https://github.com/LibreTranslate/LibreTranslate/blob/main/docker-compose.yml) file to adapt it to your deployment needs, or use an extra `docker-compose.prod.yml` file for your deployment configuration. +> +> The models are stored inside the container under `/home/libretranslate/.local/share` and `/home/libretranslate/.local/cache`. Feel free to use volumes if you do not want to redownload the models when the container is destroyed. To update the models, use the `--update-models` argument. + ## FAQ ### Externally Managed Environment