Use this .gitlab-ci.yml as a starting point for your CI system:

image: docker:latest
services:
- docker:dind

stages:
- build

build:
  stage: build
  script:
    - docker build .

The first line says you are using the latest version of Docker; once things are working, specify the version for extra robustness. The build entry specifies how to do the build, which is just executing the docker build . command you are used to using in Ubuntu. The stages entry just specifies doing the build stage; one could add additional stages for things like continuous delivery or to build multiple versions of your project.