'dockerfile copying folder after a jest test completes

Is there a way to copy test results directory from running container before it shuts down?

...
COPY tests tests
...
CMD ["yarn", "test"]
COPY /home/node/project/app/results results

I've tried COPY after or on same line (e.g, &&) as the CMD but that has not worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source