Skip to content

Multi-stage example doesn't use test stage correctly #85

@BretFisher

Description

@BretFisher

On line

## Stage 4 (testing)
# use this in automated CI
# it has prod and dev npm dependencies
# In 18.09 or older builder, this will always run
# In BuildKit, this will be skipped by default
FROM interm as test
CMD ["npm", "test"]
the test stage doesn't have npm dev dependencies, so any test commands would likely fail.

There are two ways to fix that:

  1. Use COPY --from=dev /opt/node_modules/ /opt/node_modules/ in test stage to combine the node modules.

  2. Have dev stage install all npm dependencies (remove --only=development) and then change the test stage to FROM dev as @ivorscott suggested (I like this the most).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Broken/Degraded Lecture 😥

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions