Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BretFisher opened this issue Oct 14, 2021 · 0 comments
Open

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

BretFisher opened this issue Oct 14, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@BretFisher
Copy link
Owner

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).

@BretFisher BretFisher added the bug Something isn't working label Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Broken/Degraded Lecture 😥
Development

No branches or pull requests

1 participant