From 8005a4efe6081d8ceda16465d8965288402aa3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=9E=AC?= Date: Mon, 16 Jan 2023 00:23:07 +0900 Subject: [PATCH] feat: add dockerfile, docker-compose, and gunicorn+gevent based run --- Dockerfile | 12 ++++++++++++ docker-compose.yml | 26 ++++++++++++++++++++++++++ requirements.txt | 4 +++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a921c03 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8.14-slim-buster + +WORKDIR /app + +RUN pip3 install --upgrade pip + +COPY ./requirements.txt ./requirements.txt + +# Install package from source code +RUN pip3 install -r ./requirements.txt + +EXPOSE 5001 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..478e743 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3" + +services: + nllb-translate: + container_name: nllb-translate + build: . + restart: always + ports: + - 5001:5001 + volumes: + - ./nllb_serve:/app/nllb_serve + entrypoint: [ "gunicorn" ] + command: + [ + "nllb_serve.app:app", + "-b", + "0.0.0.0:5001", + "-k", + "gevent", + "-w", + "4", + "--threads", + "8", + "--timeout", + "6000" + ] diff --git a/requirements.txt b/requirements.txt index 697f79d..ac93174 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ transformers==4.21 Flask==2.1 -torch==1.12 \ No newline at end of file +torch==1.12 +gunicorn +gevent \ No newline at end of file