Skip to content

Commit

Permalink
🐛 fix(Dockerfile): copy only necessary file to avoid unnecessary imag…
Browse files Browse the repository at this point in the history
…e rebuilding

✨ feat(Dockerfile): add support for copying app code and tests to the image to ensure they are included in the deployment
  • Loading branch information
ogabrielluiz committed Sep 22, 2023
1 parent a64c7be commit d4f3640
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 9 additions & 3 deletions base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=

7 changes: 6 additions & 1 deletion deploy/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d4f3640

Please sign in to comment.