For a lightweight testing environment, we will be leveraging an Alpine-based installation of the Chromium browser:
- Inherit from slapers/alpine-node-chromium
- Append the following configuration to Docker.integration:
Docker.integration...FROM slapers/alpine-node-chromium as testerENV BUILDER_SRC_DIR /usr/srcENV SRC_DIR /usr/srcENV TEST_SCRIPT test:prodRUN mkdir -p $SRC_DIRWORKDIR $SRC_DIRCOPY --from=builder $BUILDER_SRC_DIR $SRC_DIRCMD 'npm run $TEST_SCRIPT'
The preceding script will copy the production build from the builder stage and execute your test scripts in a predictable manner.