Take 2

Dockerfile rearranged as requested.

I needed to set `DEBIAN_FRONTEND=noninteractive`, but only on the install step, not as an `ENV`; otherwise it throws lots of errors.

I've come up with a 1-line mysql detection method that's both faster and more reliable than sleep, and causes an immediate fail if it doesn't work, rather than waiting for the next command to fail.

I have kept the bootstrap script in an external file as (since this is intended to be an easy base to modify) it's much less hassle to extend that than to deal with all the escaping and quoting issues of doing the same thing in the Dockerfile In fact it would be better to move the sed calls in there too so everything is in one place. The `ADD` of the file does create an image state, but it's deleted automatically.