mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 16:01:01 +00:00
Merge pull request #3 from vemonet/add-docker
Add Dockerfile and docker-compose
This commit is contained in:
commit
eebb4ce411
3 changed files with 47 additions and 0 deletions
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
FROM python:3.8
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
|
# Avoid rebuilding this step if no changes to requirements.txt
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Copy everything in the container
|
||||||
|
# This expects the models submodule to be present
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
ENTRYPOINT [ "python", "main.py", "--host", "0.0.0.0" ]
|
22
README.md
22
README.md
|
@ -51,6 +51,28 @@ python main.py [args]
|
||||||
|
|
||||||
Then open a web browser to http://localhost:5000
|
Then open a web browser to http://localhost:5000
|
||||||
|
|
||||||
|
### Run with Docker
|
||||||
|
|
||||||
|
Make sure you cloned the `models` submodule before building the Docker image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t libretranslate .
|
||||||
|
```
|
||||||
|
|
||||||
|
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/uav4geo/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.
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
| Argument | Description | Default |
|
| Argument | Description | Default |
|
||||||
|
|
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
libretranslate:
|
||||||
|
container_name: libretranslate
|
||||||
|
build: .
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
## Uncomment above command and define your args if necessary
|
||||||
|
# command: --ssl --ga-id MY-GA-ID --req-limit 100 --char-limit 500
|
Loading…
Reference in a new issue