ocaml-images-gen.yml 1.32 KB
Newer Older
Louis Gesbert's avatar
Louis Gesbert committed
1 2 3
.ocaml-image:
  stage: build
  image:
4
    name: gcr.io/kaniko-project/executor:debug-v0.22.0
Louis Gesbert's avatar
Louis Gesbert committed
5
    entrypoint: [""]
6 7
  variables:
    DOCKERHUB_IMAGE: ocamlpro/ocaml
Louis Gesbert's avatar
Louis Gesbert committed
8
  script:
Louis Gesbert's avatar
Louis Gesbert committed
9 10 11 12 13 14
  - |
    echo "{
      \"auths\": {
        \"$CI_REGISTRY\": {
          \"username\":\"$CI_REGISTRY_USER\",
          \"password\":\"$CI_REGISTRY_PASSWORD\"
15 16 17 18 19 20
        },
        \"https://index.docker.io/v1/\": {
          \"auth\":\"$DOCKERHUB_AUTH\"
        }
      }
    }" > /kaniko/.docker/config.json
Louis Gesbert's avatar
Louis Gesbert committed
21
  - /kaniko/executor --cache=true
Louis Gesbert's avatar
Louis Gesbert committed
22
      --registry-mirror=index.docker.io
Louis Gesbert's avatar
Louis Gesbert committed
23 24
      --context=$CI_PROJECT_DIR
      --dockerfile=$CI_PROJECT_DIR/Dockerfile
25
      --build-arg=OPAM_VERSION=$OPAM_VERSION
Louis Gesbert's avatar
Louis Gesbert committed
26 27 28
      --build-arg=OCAML_VERSION=$OCAML_VERSION
      --build-arg=LAST_REPO_UPDATE=$(date +%s)
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION}
29
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION}
Louis Gesbert's avatar
Louis Gesbert committed
30
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}
31
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}
Louis Gesbert's avatar
Louis Gesbert committed
32
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
33
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
Louis Gesbert's avatar
Louis Gesbert committed
34 35
      $(if [ "$OCAML_VERSION" = "$LATEST_OCAML_VERSION" ]; then
          echo "--destination=$CI_REGISTRY_IMAGE:latest";
36
          echo "--destination=$DOCKERHUB_IMAGE:latest";
Louis Gesbert's avatar
Louis Gesbert committed
37 38 39
        fi)
  only:
    - master