Best practices for Gitlab runners for deployment

For Why3 (and it is quite similar for Coq itself), a Docker image is used as the cache. In other words, there is a Dockerfile somewhere which describes the build/deployment environment. The Docker image is built once and then stored inside the internal Docker registry of the Gitlab instance. (It is only rebuilt when Dockerfile is modified.) Then the various jobs use it. Here is an excerpt:

build-image:
  image: docker
  script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
    - if docker pull "$IMAGE"; then echo "Image already exists!"; exit 1; fi
    - docker build --force-rm -t "$IMAGE" - < Dockerfile
    - docker push "$IMAGE"
  ...

full:
  image: "$IMAGE"
  script:
  ...
1 Like