Skip to content
Snippets Groups Projects
  1. Nov 30, 2021
    • Daniel Dehennin's avatar
      feat(docker): build images and push them to `${CI_REGISTRY}` · a18d1f90
      Daniel Dehennin authored
      Define `.build-docker-image` template used by `*-docker-build` jobs It
      build the container image and push it to `${CI_REGISTRY}`
      
      USAGE
      =====
      
      foo-docker-build:
        extends: .build-docker-image
        variables:
          DOCKERFILE: Some-specific.Dockerfile
          IMAGE_TAG: $CI_COMMIT_REF_SLUG
      
      REQUIREMENTS
      ============
      
      - A `build` stage must be present in your pipeline or it must be
        overriden by the extending job to feet your need.
      - The `.not-on-stable` rules template
      
      OPTIONAL VARIABLES
      ==================
      
      - `IMAGE_NAME`: defaults to `${CI_JOB_NAME}` with any suffix
        `-docker-build*` removed
      - `DOCKERFILE`: defaults, in order
         - to value set by the user
         - to `Dockerfile.${IMAGE_NAME}` if the file exists
         - to `Dockerfile` if the file exists
      - `IMAGE_TAG`: defaults to `git-${CI_COMMIT_SHORT_SHA}`
      
      USED CI VARIABLES
      =================
      
      - `CI_REGISTRY`
      - `CI_REGISTRY_USER`
      - `CI_REGISTRY_PASSWORD`
      - `CI_REGISTRY_IMAGE`
      a18d1f90
Loading