I've been using this in CI to build and test my Dockerized app. On GCE billing is by the minute (after a 10 minute minimum) so it hasn't been too expensive.
You may also want to look at using Preemptible VMs [1] which are up to 50% cheaper as well.
You can do this with any ci system though, not specific to gitlab.