Docker - HelpRefugees/project-flamingo GitHub Wiki

Note that this is intended primarily to support development on Windows machines, where we had trouble running Cypress in the yarn ship script, and is not run as part of the build in Travis.

There are three steps to the e2e:docker process:

  1. docker-compose build to build the containers;
  2. docker-compose run cypress e2e to execute the E2E tests in the Cypress container; and
  3. docker-compose down to stop all of the other containers.

Containers

The Docker network consists of four containers:

  • flamingo: the app itself, running in the production mode (i.e. the Express app serves both the API and the compiled React frontend). This image is produced in a multi-step build using the Dockerfile in the project root directory.

  • cypress: runs the E2E tests using the Cypress Chrome browser image, built from e2e/Dockerfile. The default command for this image is just yarn -v, so you can use docker-compose up to bring up the network if you don't want to run the tests.

  • zapier: a test double providing the email webhook. This is a simple spy that accepts any POST request and stores the body, built from e2e/fixtures/Dockerfile.

  • flamongo: the Mongo database. This is just the regular mongo:4-xenial image.

Network

According to the network rules: flamingo can access both flamongo and zapier; cypress can access all three other containers. For example, here is a sequence diagram (generated using https://davidje13.github.io/SequenceDiagram/) showing a test that touches all four containers:

Password reset sequence diagram