Skip to content

docker runner cache maven repository

Hi

I'm using gitlab and a CI runner(docker version). I ran project successfully. But I'd like to cache the maven repository(/root/.m2 directory) for each build. Because downloading those dependencies takes a long time.

I tried mounting /root/.m2. But it's not working. Would you give me a helping hand please?

Here is my gitlab-ci.yml

image: maven:3-jdk-7

variables:
  MAVEN_OPTS: "-Xms512m -Xmx1024m"

test:
  script: "mvn test -Pqa"

build:
  script: "mvn package -Dmaven.test.skip=true -Pqa -Duser.timezone=UTC"

and config.toml

[[runners]]
  [runners.docker]
    volumes = ["/root/.m2:/root/.m2"]

Docker version 1.7.1, build 786b29d/1.7.1

I'm using the latest version of gitlab