diff --git a/.dockerignore b/.dockerignore index 7bd80db..405099e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ .env -env +model +__pycache__ diff --git a/.tool-versions b/.tool-versions index 47cd22e..aa17ac3 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -python 3.10.13 +python 3.11.5 diff --git a/Dockerfile b/Dockerfile index 4eb4c93..0cbfa17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,10 @@ -FROM python:3.10-bookworm AS base +FROM git.orionkindel.com/tpl/asdf:bookworm -FROM base AS tini +COPY .tool-versions ./ +RUN asdf install -ENV TINI_VERSION v0.19.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini -ENTRYPOINT ["/tini", "--"] - -FROM tini AS tools -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - export DEBIAN_FRONTEND=noninteractive \ - && apt-get update -y \ - && apt-get upgrade -y - -COPY requirements.txt requirements.txt +COPY requirements.txt ./ RUN pip install -r requirements.txt -FROM tools AS api - -COPY . . -CMD ["python", "."] +COPY ./ ./ +CMD ["python", "./"] diff --git a/__main__.py b/__main__.py index ad46776..6078029 100644 --- a/__main__.py +++ b/__main__.py @@ -16,6 +16,7 @@ model = T5ForConditionalGeneration.from_pretrained( load_dotenv() api_keys = getenv('API_KEYS').split(sep=",") +port = getenv('PORT') or 9010 generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)