From d4f3640e5f33aeaa3bcfa1c480a2b91cbd4a1798 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 22 Sep 2023 10:46:01 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(Dockerfile):=20copy=20only?= =?UTF-8?q?=20necessary=20file=20to=20avoid=20unnecessary=20image=20rebuil?= =?UTF-8?q?ding=20=E2=9C=A8=20feat(Dockerfile):=20add=20support=20for=20co?= =?UTF-8?q?pying=20app=20code=20and=20tests=20to=20the=20image=20to=20ensu?= =?UTF-8?q?re=20they=20are=20included=20in=20the=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base.Dockerfile | 12 +++++++++--- deploy/base.Dockerfile | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/base.Dockerfile b/base.Dockerfile index aa50fe90f..c76bbbcda 100644 --- a/base.Dockerfile +++ b/base.Dockerfile @@ -83,9 +83,15 @@ WORKDIR $PYSETUP_PATH COPY --from=builder-base $POETRY_HOME $POETRY_HOME COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH -COPY ./src/backend ./src/backend -COPY ./tests ./tests - +# Copy just one file to avoid rebuilding the whole image +COPY ./src/backend/langflow/__init__.py ./src/backend/langflow/__init__.py # quicker install as runtime deps are already installed RUN --mount=type=cache,target=/root/.cache \ poetry install --with=dev --extras deploy + +# copy in our app code +COPY ./src/backend ./src/backend +RUN --mount=type=cache,target=/root/.cache \ + poetry install --with=dev --extras deploy +COPY ./tests ./tests= + diff --git a/deploy/base.Dockerfile b/deploy/base.Dockerfile index 83e875fa6..323663283 100644 --- a/deploy/base.Dockerfile +++ b/deploy/base.Dockerfile @@ -81,7 +81,12 @@ WORKDIR $PYSETUP_PATH COPY --from=builder-base $POETRY_HOME $POETRY_HOME COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH -COPY ./src/backend ./src/backend +# Copy just one file to avoid rebuilding the whole image +COPY ./src/backend/langflow/__init__.py ./src/backend/langflow/__init__.py # quicker install as runtime deps are already installed RUN --mount=type=cache,target=/root/.cache \ poetry install --with=dev --extras deploy + +# copy in our app code +COPY ./src/backend ./src/backend +COPY ./tests ./tests