Example nginx as service

Examples of nginx service on GitlabCI for e2e tests

We have a php application and we’re running Cypress tests for e2e testing. At the moment I’m using the Symfony server to run the backend, but as the tests grow that server is not performant enough.

    - /root/.symfony/bin/symfony server:start --port 8080 --no-tls 2>/dev/null &
    - echo "$!" >> /tmp/symfony-server.pid
    - wait-on http://localhost:8080/api

Instead I’d like to run nginx, it should be more performant, and it’s also what the production environment will run on.

I see two options:

  1. Use a container that includes the cypress and nginx required tooling, run the installation and configuration inline, and start the server with bash. e.g. /usr/bin/nginx -s start.
  2. Use an nginx service.

I’d prefer to use the service, as I suspect it will perform better (just a hunch). Plus it feels “cleaner” to keep the two things separate. What I’m looking for is a simplified example configuration for either of these set-ups. The examples in the docs are around database, which might be similar, but are thin on details. GitLab CI services examples | GitLab

I have the same question.