From aa2c288e8042b3a33d6e881d492d783d38703be2 Mon Sep 17 00:00:00 2001 From: Ryo Igarashi Date: Mon, 25 Mar 2024 01:47:25 +0900 Subject: [PATCH] Improve Dockerfile to cache pip dependency --- src/ainu_lm_trainer/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ainu_lm_trainer/Dockerfile b/src/ainu_lm_trainer/Dockerfile index b1621ee..3080b4c 100644 --- a/src/ainu_lm_trainer/Dockerfile +++ b/src/ainu_lm_trainer/Dockerfile @@ -5,13 +5,18 @@ ARG HF_TOKEN ENV TRANSFORMERS_NO_ADVISORY_WARNINGS=1 RUN apt update -COPY . /workspace -RUN pip install poetry -RUN poetry config virtualenvs.create false -RUN poetry export -f requirements.txt --output requirements.txt +COPY pyproject.toml poetry.lock /workspace/ + +RUN pip install poetry \ + && poetry config virtualenvs.create false \ + && poetry export -f requirements.txt --output requirements.txt --without-hashes \ + && pip uninstall -y poetry + RUN pip install -r requirements.txt +COPY . /workspace + RUN python3 -m src.ainu_lm_trainer.app.main cache ENTRYPOINT ["python3", "-m", "src.ainu_lm_trainer.app.main"]