diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b7f51c815d462e33d7674584d68dd8318d21f902..e2d8f44effcfb5f34c6c85fe214ae2eb71af88ad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,6 +12,7 @@ image: python:3.8
 # only cache local items.
 variables:
   PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+  CI_REGISTRY: "registry-gitlab.pasteur.fr"
 
 # Pip's cache doesn't store the python packages
 # https://pip.pypa.io/en/stable/reference/pip_install/#caching
@@ -20,15 +21,46 @@ variables:
 # them in a virtualenv and cache it as well.
 cache:
   paths:
-    - .cache/pip
+    # - .cache/pip
     - .tox/.tox
 
+stages:
+  - test
+  - build
 
 test:
+  stage: test
   script:
     - pip install tox flake8 pytest 
     - tox 
 
+docker-build:
+  # Use the official docker image.
+  image: registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:latest
+  stage: build
+  services:
+    - registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
+  before_script:
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  # Default branch leaves tag empty (= latest tag)
+  # All other branches are tagged with the escaped branch name (commit ref slug)
+  script:
+    - |
+      if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
+        tag=""
+        echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
+      else
+        tag=":$CI_COMMIT_REF_SLUG"
+        echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
+      fi
+    - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
+    - docker push "$CI_REGISTRY_IMAGE${tag}"
+  # Run this job in a branch where a Dockerfile exists
+  rules:
+    - if: $CI_COMMIT_BRANCH
+      exists:
+        - Dockerfile
+
 
 # pages:
 #   script: