Optimize Dockerfile.ci with Docker best practices

3 jobs for master in 149 minutes and 29 seconds (queued for 3 seconds)