Start a web server during build for tests?

I see that a database can be linked during a build using .drone.yml, but could I start a web server (even just for one build-stage/command) with the commit being built so that I can run a test suite such as in Selenium?

If I had the test runner available in the base docker image it’s not problem to run it as a build command, but without a web server running there is no URL I could point it to… local or otherwise.


The answer to this depends on the language and tooling you need. This is an example project (in drone 0.4) that runs a Go program (http server) and then runs tests using Selenium

Thanks Brad!

I hadn’t seen the demo repos and that’s pulling a lot together for me.

If we work around the platform issue (well, partly) for a moment by assuming that the code/commit drone is building is just static html content, then I guess the main issue with running say, nginx, as an entry in compose: to serve that content is that you’d have to get a volume into it that nginx container with the contents of the build? and there’s not an easy shorthand for the host’s side of that volume string?

that you’d have to get a volume into it that nginx container with the contents of the build

so the good news here is that drone mounts your workspace (where your code is cloned) into every container, including service containers. This means your source would be available to an nginx container at the workspace path.

Here is some information about the workspace in drone version 0.4

the issue you’ll face is if you need everything compiled or generated before nginx starts. If this is the case you will need drone 0.5 (and you’ll need to wait a few days for an upcoming patch I have locally) to enable the configuration described here: