ocaml-images-gen.yml 1.27 KB
Newer Older
Louis Gesbert's avatar
Louis Gesbert committed
1 2 3 4 5
.ocaml-image:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    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 22 23
  - /kaniko/executor --cache=true
      --context=$CI_PROJECT_DIR
      --dockerfile=$CI_PROJECT_DIR/Dockerfile
24
      --build-arg=OPAM_VERSION=$OPAM_VERSION
Louis Gesbert's avatar
Louis Gesbert committed
25 26 27
      --build-arg=OCAML_VERSION=$OCAML_VERSION
      --build-arg=LAST_REPO_UPDATE=$(date +%s)
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION}
28
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION}
Louis Gesbert's avatar
Louis Gesbert committed
29
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}
30
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}
Louis Gesbert's avatar
Louis Gesbert committed
31
      --destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
32
      --destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
Louis Gesbert's avatar
Louis Gesbert committed
33 34
      $(if [ "$OCAML_VERSION" = "$LATEST_OCAML_VERSION" ]; then
          echo "--destination=$CI_REGISTRY_IMAGE:latest";
35
          echo "--destination=$DOCKERHUB_IMAGE:latest";
Louis Gesbert's avatar
Louis Gesbert committed
36 37 38
        fi)
  only:
    - master