diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..de98b347bf4ae59e000cae35d458425f7b21eb4d
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,32 @@
+stages:
+  - generate-test-env
+  - test
+  - dockerize
+
+variables:
+  # to avoid "fatal: git fetch-pack: expected shallow list"
+  GIT_STRATEGY: clone
+
+pre_test:
+  stage: generate-test-env
+  tags:
+    - shell
+  script:
+    - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
+    - docker build -t "${CI_REGISTRY_IMAGE}/vospace-test-env" -f src/test/resources/testing-Dockerfile .
+        --build-arg FILE_CATALOG_REPO_URL="https://gitlab-ci-token:${CI_JOB_TOKEN}@www.ict.inaf.it/gitlab/ia2/vospace-file-catalog.git"
+    - docker push "${CI_REGISTRY_IMAGE}/vospace-test-env"
+  only:
+    - ci-test
+
+test:
+  stage: test
+  tags:
+    - docker
+  image: "${CI_REGISTRY_IMAGE}/vospace-test-env"
+  script:
+    - mvn clean test -Dinit_database_scripts_path=../../vospace-file-catalog
+    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv
+  coverage: '/coverage=\d+\.\d+/'
+  only:
+    - ci-test
diff --git a/src/test/resources/testing-Dockerfile b/src/test/resources/testing-Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..5cd3bc3a21610b7fc005297f43fca798a3e0debf
--- /dev/null
+++ b/src/test/resources/testing-Dockerfile
@@ -0,0 +1,13 @@
+# Dockerfile for setting up an environment to run tests
+
+FROM git.ia2.inaf.it:5050/ia2/ia2-devops/maven-otj-pg-embedded
+
+USER root
+
+RUN apt-get update && apt-get install -y git
+
+ARG FILE_CATALOG_REPO_URL
+
+RUN git clone ${FILE_CATALOG_REPO_URL}
+
+USER postgres