🐛 fix(Dockerfile): copy only necessary file to avoid unnecessary image rebuilding
✨ feat(Dockerfile): add support for copying app code and tests to the image to ensure they are included in the deployment
This commit is contained in:
parent
a64c7bea7f
commit
d4f3640e5f
2 changed files with 15 additions and 4 deletions
|
|
@ -83,9 +83,15 @@ WORKDIR $PYSETUP_PATH
|
||||||
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
||||||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
|
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
|
||||||
|
|
||||||
COPY ./src/backend ./src/backend
|
# Copy just one file to avoid rebuilding the whole image
|
||||||
COPY ./tests ./tests
|
COPY ./src/backend/langflow/__init__.py ./src/backend/langflow/__init__.py
|
||||||
|
|
||||||
# quicker install as runtime deps are already installed
|
# quicker install as runtime deps are already installed
|
||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
poetry install --with=dev --extras deploy
|
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=
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,12 @@ WORKDIR $PYSETUP_PATH
|
||||||
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
||||||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
|
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
|
# quicker install as runtime deps are already installed
|
||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
poetry install --with=dev --extras deploy
|
poetry install --with=dev --extras deploy
|
||||||
|
|
||||||
|
# copy in our app code
|
||||||
|
COPY ./src/backend ./src/backend
|
||||||
|
COPY ./tests ./tests
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue