Jib

Creates container images with jib.

The following artifact extensions are supported by this packager:

  • .jar

  • .tgz

  • .txz

  • .tar.gz

  • .tar.xz

  • .tar

  • .zip

Distribution Support

Configuration

Legend:

  • required

  • optional

  • may use environment variable

  • accepts Name Templates

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

# 
packagers:
  # 
  jib:
    # Enables or disables Jib.
    # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    #  
    active: ALWAYS

    # Let the release continue if the packager fails.
    # Defaults to `false`.
    # 
    continueOnError: true

    # Custom download URL.
    #  
    downloadUrl: https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}

    # Additional properties used when evaluating templates.
    #  
    extraProperties:
      # Key will be capitalized and prefixed with `jib`, i.e, `jibFoo`.
      foo: bar

    # Directory with file templates used to prepare the Jib distribution.
    # Defaults to `src/jreleaser/distributions/#{distribution.name}/jib`.
    # If specified, path must exist.
    # 
    templateDirectory: path/to/jib/templates

    # List of template files to be skipped.
    # Value may be an exact match or a regex.
    # 
    skipTemplates:
      - README.md.tpl

    # Git author used to commit to the repository.
    # 
    commitAuthor:
      # Name used when authoring commits.
      # Defaults to `jreleaserbot`.
      # 
      name: jreleaserbot

      # E-mail used when authoring commits.
      # Defaults to `jreleaser@kordamp.org`.
      # 
      email: jreleaser@kordamp.org

    # Git repository to push the build.yml to.
    # Defaults are shown.
    # 
    repository:
      # Enables or disables the repository.
      # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      # Defaults to `RELEASE`.
      # 
      active: ALWAYS

      # Stores files in a folder matching the image's version/tag.
      # Defaults to `false`.
      # 
      versionedSubfolders: true

      # The owner of the repository.
      # Defaults to the same owner as the release repository.
      # 
      owner: duke

      # The name of the repository.
      # Defaults to `app-jib`.
      # 
      name: app-jib

      # The tag associated with the build.yml.
      # If left unspecified, will use `{{tagName}}`.
      #  
      tagName: '{{distributionName}}-{{tagName}}'

      # The target branch to pull from.
      # Defaults to the branch pointed by HEAD.
      #  
      branch: HEAD

      # The target branch to push to.
      # Defaults to the branch pointed by `#{branch}`.
      #   
      branchPush: '{{projectName}}-{{tagName}}'

      # Username used for authoring commits.
      # Must have write access to the repository.
      # Defaults to the same username as the release repository.
      #  
      username: duke

      # Password or OAuth token with write access to the repository.
      #  
      token: __USE_ENVIRONMENT_VARIABLE__

      # Message when committing to the repository.
      # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
      #  
      commitMessage: '{{distributionName}} {{tagName}}'

      # Additional properties used when evaluating templates.
      #  
      extraProperties:
        # Key will be capitalized and prefixed with `repository`, i.e, `repositoryFoo`.
        foo: bar

    # The base Jib image to use.
    #  
    baseImage: "alpine:latest"

    # Defines the tool version to use.
    # 
    version: 0.12.0

    # Sets the creation time of the container only.
    # Can be: millis since epoch (ex: 1000) or an ISO 8601 creation time (ex: 2020-06-08T14:54:36+00:00).
    # 
    creationTime: 2000

    # Image format.
    # Valid values are [`DOCKER`, `OCI`].
    # 
    format: DOCKER

    # Image working directory
    # Defaults to `/workspace`.
    # 
    workingDirectory: /workspace

    # The user to run the container (does not affect file permissions)
    # 
    user: duke

    # A list of image names.
    # If unspecified, a single image `{{repoOwner}}/{{distributionName}}:{{tagName}}`
    # will be created.
    #  
    imageNames:
      - "{{repoOwner}}/{{distributionName}}:{{tagName}}"
      - "duke/app:latest"

    # A map of environment variables.
    # 
    environment:
      FOO: bar

    # A map of OCI labels.
    #  
    labels:
      foo: bar

    # Set of volume mount points.
    # 
    volumes:
      - '/volume1'

    # Set of exposed ports metadata (port-number/protocol).
    # 
    exposedPorts:
      - '123/udp'

    # A list of jib registries where images will be published.
    # 
    registries:

        # The name of the registry. Must be unique.
        # 
      - name: myRegistry

        # The address of the jib registry.
        # 
        server: ghcr.io

        # Username for communicating with both target and base image registries.
        # Defaults to the same username as the release repository.
        #  
        username: duke

        # Username for communicating with target image registry.
        #  
        toUsername: duke

        # Username for communicating with base image registry.
        #  
        fromUsername: duke

        # Password for communicating with both target and base image registries.
        #  
        password: __USE_ENVIRONMENT_VARIABLE__

        # Password for communicating with target registry.
        #  
        toPassword: __USE_ENVIRONMENT_VARIABLE__

        # Password for communicating with base image registry.
        #  
        fromPassword: __USE_ENVIRONMENT_VARIABLE__
# 
[packagers.jib]
  # Enables or disables Jib.
  # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  #  
  active = "ALWAYS"

  # Let the release continue if the packager fails.
  # Defaults to `false`.
  # 
  continueOnError = true

  # Custom download URL.
  #  
  downloadUrl = "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}"

  # Additional properties used when evaluating templates.
  #  
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `jib`, i.e, `jibFoo`.

  # Directory with file templates used to prepare the Jib distribution.
  # Defaults to `src/jreleaser/distributions/#{distribution.name}/jib`.
  # If specified, path must exist.
  # 
  templateDirectory = "path/to/jib/templates"

  # List of template files to be skipped.
  # Value may be an exact match or a regex.
  # 
  skipTemplates = [ "README.md.tpl" ]

  # Git author used to commit to the repository.

  # Name used when authoring commits.
  # Defaults to `jreleaserbot`.
  # 
  commitAuthor.name = "jreleaserbot"

  # E-mail used when authoring commits.
  # Defaults to `jreleaser@kordamp.org`.
  # 
  commitAuthor.email = "jreleaser@kordamp.org"

  # Git repository to push the build.yml to.
  # Defaults are shown.

  # Enables or disables the repository.
  # Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `RELEASE`.
  # 
  repository.active = "ALWAYS"

  # Stores files in a folder matching the image's version/tag.
  # Defaults to `false`.
  # 
  repository.versionedSubfolders = true

  # The owner of the repository.
  # Defaults to the same owner as the release repository.
  # 
  repository.owner = "duke"

  # The name of the repository.
  # Defaults to `app-jib`.
  # 
  repository.name = "app-jib"

  # The tag associated with the build.yml.
  # If left unspecified, will use `{{tagName}}`.
  #  
  repository.tagName = "{{distributionName}}-{{tagName}}"

  # The target branch to pull from.
  # Defaults to the branch pointed by HEAD.
  #  
  repository.branch = "HEAD"

  # The target branch to push to.
  # Defaults to the branch pointed by `#{branch}`.
  #    
  repository.branchPush = "{{projectName}}-{{tagName}}"

  # Username used for authoring commits.
  # Must have write access to the repository.
  # Defaults to the same username as the release repository.
  #  
  repository.username = "duke"

  # Password or OAuth token with write access to the repository.
  #  
  repository.token = "__USE_ENVIRONMENT_VARIABLE__"

  # Message when committing to the repository.
  # If left unspecified, `{{distributionName}} {{tagName}}` will be used.
  #  
  repository.commitMessage = "{{distributionName}} {{tagName}}"

  # Additional properties used when evaluating templates.
  #  
  repository.extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `repository`, i.e, `repositoryFoo`.

  # The base Jib image to use.
  #  
  baseImage = "alpine:latest"

  # Defines the tool version to use.
  # 
  version = "0.12.0"

  # Sets the creation time of the container only.
  # Can be: millis since epoch (ex: 1000) or an ISO 8601 creation time (ex: 2020-06-08T14:54:36+00:00).
  # 
  creationTime = "2000"

  # Image format.
  # Valid values are [`DOCKER`, `OCI`].
  # 
  format = "DOCKER"

  # Image working directory
  # Defaults to `/workspace`.
  # 
  workingDirectory = "/workspace"

  # The user to run the container (does not affect file permissions)
  # 
  user = "duke"

  # A list of image names.
  # If unspecified, a single image `{{repoOwner}}/{{distributionName}}:{{tagName}}`
  # will be created.
  #  
  imageNames = [
    "{{repoOwner}}/{{distributionName}}:{{tagName}}",
    "duke/app:latest"]

  # A map of environment variables.
  # 
  environment.FOO = "bar"

  # A map of OCI labels.
  #  
  labels.foo = "bar"

  # Set of volume mount points.
  # 
  volumes = ["/volume1"]

  # Set of exposed ports metadata (port-number/protocol).
  # 
  exposedPorts = ["123/udp"]

  # A list of jib registries where images will be published.
  # 
  [[packagers.jib.registries]]
    # The name of the registry. Must be unique.
    # 
    name = "myRegistry"

    # The address of the jib registry.
    # 
    server = "ghcr.io"

    # Username for communicating with both target and base image registries.
    # Defaults to the same username as the release repository.
    #  
    username = "duke"

    # Username for communicating with target image registry.
    #  
    toUsername = "duke"

    # Username for communicating with base image registry.
    #  
    fromUsername = "duke"

    # Password for communicating with both target and base image registries.
    #  
    password = "__USE_ENVIRONMENT_VARIABLE__"

    # Password for communicating with target image registry.
    #  
    toPassword = "__USE_ENVIRONMENT_VARIABLE__"

    # Password for communicating with base image registry.
    #  
    fromBassword = "__USE_ENVIRONMENT_VARIABLE__"
{
  // 
  "packagers": {
    // 
    "jib": {
      // Enables or disables Jib.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      //  
      "active": "ALWAYS",

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      "continueOnError": true,

      // Custom download URL.
      //  
      "downloadUrl": "https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}",

      // Additional properties used when evaluating templates.
      //  
      "extraProperties": {
        // Key will be capitalized and prefixed with `jib`, i.e, `jibFoo`.
        "foo": "bar"
      },

      // Directory with file templates used to prepare the Jib distribution.
      // Defaults to `src/jreleaser/distributions/#{distribution.name}/jib`.
      // If specified, path must exist.
      // 
      "templateDirectory": "path/to/jib/templates",

      // List of template files to be skipped.
      // Value may be an exact match or a regex.
      // 
      "skipTemplates": [
        "README.md.tpl"
      ],

      // Git author used to commit to the repository.
      // 
      "commitAuthor": {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        "name": "jreleaserbot",

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        "email": "jreleaser@kordamp.org"
      },

      // Git repository to push the build.yml to.
      // Defaults are shown.
      // 
      "repository": {
        // Enables or disables the repository.
        // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        "active": "ALWAYS",

        // Stores files in a folder matching the image's version/tag.
        // Defaults to `false`.
        // 
        "versionedSubfolders": true,

        // The owner of the repository.
        // Defaults to the same owner as the release repository.
        // 
        "owner": "duke",

        // The name of the repository.
        // Defaults to `app-jib`.
        // 
        "name": "app-jib",

        // The tag associated with the build.yml.
        // If left unspecified, will use `{{tagName}}`.
        //  
        "tagName": "{{distributionName}}-{{tagName}}",

        // The target branch to pull from.
        // Defaults to the branch pointed by HEAD.
        //  
        "branch": "HEAD",

        // The target branch to push to.
        // Defaults to the branch pointed by `#{branch}`.
        //   
        "branchPush": "{{projectName}}-{{tagName}}",

        // Username used for authoring commits.
        // Must have write access to the repository.
        // Defaults to the same username as the release repository.
        //  
        "username": "duke",

        // Password or OAuth token with write access to the repository.
        //  
        "token": "__USE_ENVIRONMENT_VARIABLE__",

        // Message when committing to the repository.
        // If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        //  
        "commitMessage": "{{distributionName}} {{tagName}}",

        // Additional properties used when evaluating templates.
        //  
        "extraProperties": {
          // Key will be capitalized and prefixed with `repository`, i.e, `repositoryFoo`.
          "foo": "bar"
        }
      },

      // The base Jib image to use.
      //  
      "baseImage": "alpine:latest",

      // Defines the tool version to use.
      // 
      "version": "0.12.0",

      // Sets the creation time of the container only.
      // Can be: millis since epoch (ex: 1000) or an ISO 8601 creation time (ex: 2020-06-08T14:54:36+00:00).
      // 
      "creationTime": "2000",

      // Image format.
      // Valid values are [`DOCKER`, `OCI`].
      // 
      "format": "DOCKER",

      // Image working directory
      // Defaults to `/workspace`.
      // 
      "workingDirectory": "/workspace",

      // The user to run the container (does not affect file permissions)
      // 
      "user": "duke",

      // A list of image names.
      // If unspecified, a single image `{{repoOwner}}/{{distributionName}}:{{tagName}}`
      // will be created.
      //  
      "imageNames": [
        "{{repoOwner}}/{{distributionName}}:{{tagName}}",
        "duke/app:latest"
      ],

      // A map of environment variables.
      // 
      "environment": {
        "FOO": "bar"
      },

      // A map of OCI labels.
      //  
      "labels": {
        "foo": "bar"
      },

      // Set of volume mount points.
      // 
      "volumes": [
        "/volume1"
      ],

      // Set of exposed ports metadata (port-number/protocol).
      // 
      "exposedPorts": [
        "123/udp"
      ]

      // A list of jib registries where images will be published.
      // 
      "registries": [

        {
          // The name of the registry. Must be unique.
          // 
          "name": "myRegistry",

          // The address of the jib registry.
          // 
          "server": "ghcr.io",

          // Username for communicating with both target and base image registries.
          // Defaults to the same username as the release repository.
          //  
          "username": "duke",

          // Username for communicating with target image registry.
          //  
          "toUsername": "duke",

          // Username for communicating with both target and base image registries.
          //  
          "fromUsername": "duke",

          // Password for communicating with base image registry.
          //  
          "password": "__USE_ENVIRONMENT_VARIABLE__",

          // Password for communicating with target image registry.
          //  
          "toPassword": "__USE_ENVIRONMENT_VARIABLE__",

          // Password for communicating with base image registry.
          //  
          "fromPassword": "__USE_ENVIRONMENT_VARIABLE__"
        }
      ]
    }
  }
}
<jreleaser>
  <!--
    
  -->
  <packagers>
    <!--
      
    -->
    <jib>
      <!--
        Enables or disables Jib.
        Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
         
      -->
      <active>ALWAYS</active>

      <!--
        Let the release continue if the packager fails.
        Defaults to `false`.
        
      -->
      <continueOnError>true</continueOnError>

      <!--
        Custom download URL.
         
      -->
      <downloadUrl>https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}</downloadUrl>

      <!--
        Additional properties used when evaluating templates.
         
      -->
      <extraProperties>
        <!--
          Key will be capitalized and prefixed with `jib`, i.e, `jibFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>

      <!--
        Directory with file templates used to prepare the Jib distribution.
        Defaults to `src/jreleaser/distributions/#{distribution.name}/jib`.
        If specified, path must exist.
        
      -->
      <templateDirectory>path/to/jib/templates</templateDirectory>

      <!--
        List of template files to be skipped.
        Value may be an exact match or a regex.
        
      -->
      <skipTemplates>
        <skipTemplate>README.md.tpl</skipTemplate>
      </skipTemplates>

      <!--
        Git author used to commit to the repository.
        
      -->
      <commitAuthor>

        <!--
           Name used when authoring commits.
          Defaults to `jreleaserbot`.
          
        -->
        <name>jreleaserbot</name>

        <!--
          E-mail used when authoring commits.
          Defaults to `jreleaser@kordamp.org`.
          
        -->
        <email>jreleaser@kordamp.org</email>
      </commitAuthor>

      <!--
        Git repository to push the build.yml to.
        Defaults are shown.
        
      -->
      <repository>
        <!--
          Enables or disables the repository.
          Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
          Defaults to `RELEASE`.
          
        -->
        <active>ALWAYS</active>

        <!--
          Stores files in a folder matching the image's version/tag.
          Defaults to `false`.
          
        -->
        <versionedSubfolders>true</versionedSubfolders>

        <!--
          The owner of the repository.
          Defaults to the same owner as the release repository.
          
        -->
        <owner>duke</owner>

        <!--
          The name of the repository.
          Defaults to `app-jib`.
          
        -->
        <name>app-jib</name>

        <!--
          The tag associated with the build.yml.
          If left unspecified, will use `{{tagName}}`.
           
        -->
        <tagName>{{distributionName}}-{{tagName}}</tagName>

        <!--
          The target branch to pull from.
          Defaults to the branch pointed by HEAD.
           
        -->
        <branch>HEAD</branch>

        <!--
          The target branch to push to.
          Defaults to the branch pointed by `#{branch}`.
            
        -->
        <branchPush>{{projectName}}-{{tagName}}</branchPush>

        <!--
          Username used for authoring commits.
          Must have write access to the repository.
          Defaults to the same username as the release repository.
           
        -->
        <username>duke</username>

        <!--
          Password or OAuth token with write access to the repository.
           
        -->
        <token>__USE_ENVIRONMENT_VARIABLE__</token>

        <!--
          Message when committing to the repository.
          If left unspecified, `{{distributionName}} {{tagName}}` will be used.
           
        -->
        <commitMessage>{{distributionName}} {{tagName}}</commitMessage>

        <!--
          Additional properties used when evaluating templates.
           
        -->
        <extraProperties>
          <!--
            Key will be capitalized and prefixed with `repository`, i.e, `repositoryFoo`.
          -->
          <foo>bar</foo>
        </extraProperties>
      </repository>

      <!--
        The base Jib image to use.
         
      -->
      <baseImage>alpine:latest</baseImage>

      <!--
        Defines the tool version to use.
        
      -->
      <version>0.12.0</version>

      <!--
        Sets the creation time of the container only.
        Can be: millis since epoch (ex: 1000) or an ISO 8601 creation time (ex: 2020-06-08T14:54:36+00:00).
        
      -->
      <creationTime>2000</creationTime>

      <!--
        Image format.
        Valid values are [`DOCKER`, `OCI`].
        
      -->
      <format>DOCKER</format>

      <!--
        Image working directory
        Defaults to `/workspace`.
        
      -->
      <workingDirectory>/workspace</workingDirectory>

      <!--
        The user to run the container (does not affect file permissions)
        
      -->
      <user>duke</user>

      <!--
        A list of image names.
        If unspecified, a single image `{{repoOwner}}/{{distributionName}}:{{tagName}}`
        will be created.
         
      -->
      <imageNames>
        <imageName>{{repoOwner}}/{{distributionName}}:{{tagName}}</imageName>
        <imageName>duke/app:latest</imageName>
      </imageNames>

      <!--
        A map of environment variables.
        
      -->
      <environment>
        <FOO>bar</FOO>
      </environment>

      <!--
        A map of OCI labels.
         
      -->
      <labels>
        <foo>bar</foo>
      </labels>

      <!--
        Set of volume mount points.
        
      -->
      <volumes>
        <volume>/volume1</volume>
      </volumes>

      <!--
        Set of exposed ports metadata (port-number/protocol).
        
      -->
      <exposedPorts>
        <exposedPort>123/udp</exposedPort>
      </exposedPorts>

      <!--
        A list of jib registries where images will be published.
        
      -->
      <registries>
        <registry>
          <!--
             The name of the registry. Must be unique.
             
          -->
          <name>myRegistry</name>

          <!--
            The address of the jib registry.
            
          -->
          <server>pass[https: myregistry.com]</server>

          <!--
            Username for communicating with both target and base image registries.
            Defaults to the same username as the release repository.
             
          -->
          <username>duke</username>

          <!--
            Username for communicating with target image registry.
             
          -->
          <toUsername>duke</toUsername>

          <!--
            Username for communicating with base image registry.
             
          -->
          <fromUsername>duke</fromUsername>

          <!--
            Password for communicating with both target and base image registries.
             
          -->
          <password>__USE_ENVIRONMENT_VARIABLE__</password>

          <!--
            Password for communicating with target image registry.
             
          -->
          <toPassword>__USE_ENVIRONMENT_VARIABLE__</toPassword>

          <!--
            Password for communicating with base image registry.
             
          -->
          <fromPassword>__USE_ENVIRONMENT_VARIABLE__</fromPassword>
        </registry>
      </registries>
    </jib>
  </packagers>
</jreleaser>
jreleaser {
  // 
  packagers {
    // 
    jib {
      // Enables or disables Jib.
      // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      //  
      active = 'ALWAYS'

      // Let the release continue if the packager fails.
      // Defaults to `false`.
      // 
      continueOnError = true

      // Custom download URL.
      //  
      downloadUrl = 'https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFile}}'

      // Additional properties used when evaluating templates.
      // Key will be capitalized and prefixed with `jib`, i.e, `jibFoo`.
      //  
      extraProperties.put('foo', 'bar')

      // Directory with file templates used to prepare the Jib distribution.
      // Defaults to `src/jreleaser/distributions/#{distribution.name}/jib`.
      // If specified, path must exist.
      // 
      templateDirectory = 'path/to/jib/templates'

      // List of template files to be skipped.
      // Value may be an exact match or a regex.
      // 
      skipTemplate('README.md.tpl')

      // Git author used to commit to the repository.
      // 
      commitAuthor {
        // Name used when authoring commits.
        // Defaults to `jreleaserbot`.
        // 
        name = 'jreleaserbot'

        // E-mail used when authoring commits.
        // Defaults to `jreleaser@kordamp.org`.
        // 
        email = 'jreleaser@kordamp.org'
      }

      // Git repository to push the build.yml to.
      // Defaults are shown.
      // 
      repository {
        // Enables or disables the repository.
        // Supported values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        // Defaults to `RELEASE`.
        // 
        active = 'ALWAYS'

        // Stores files in a folder matching the image's version/tag.
        // Defaults to `false`.
        // 
        versionedSubfolders = true

        // The owner of the repository.
        // Defaults to the same owner as the release repository.
        // 
        repoOwner = 'duke'

        // The name of the repository.
        // Defaults to `app-jib`.
        // 
        name = 'app-jib'

        // The tag associated with the build.yml.
        // If left unspecified, will use `{{tagName}}`.
        //  
        tagName = '{{distributionName}}-{{tagName}}'

        // The target branch to pull from.
        // Defaults to the branch pointed by HEAD.
        //  
        branch = 'HEAD'

        // The target branch to push to.
        // Defaults to the branch pointed by `#{branch}`.
        //   
        branchPush = '{{projectName}}-{{tagName}}'

        // Username used for authoring commits.
        // Must have write access to the repository.
        // Defaults to the same username as the release repository.
        //  
        username = 'duke'

        // Password or OAuth token with write access to the repository.
        //  
        token = '__USE_ENVIRONMENT_VARIABLE__'

        // Message when committing to the repository.
        // If left unspecified, `{{distributionName}} {{tagName}}` will be used.
        //  
        commitMessage = '{{distributionName}} {{tagName}}'

        // Additional properties used when evaluating templates.
        // Key will be capitalized and prefixed with `repository`, i.e, `repositoryFoo`.
        //  
        extraProperties.put('foo', 'bar')
      }

      // The base Jib image to use.
      //  
      baseImage = 'alpine:latest'

      // Defines the tool version to use.
      // 
      version = '0.12.0'

      // Sets the creation time of the container only.
      // Can be: millis since epoch (ex: 1000) or an ISO 8601 creation time (ex: 2020-06-08T14:54:36+00:00).
      // 
      creationTime = '2000'

      // Image format.
      // Valid values are [`DOCKER`, `OCI`].
      // 
      format = 'DOCKER'

      // Image working directory
      // Defaults to `/workspace`.
      // 
      workingDirectory = '/workspace'

      // The user to run the container (does not affect file permissions)
      // 
      user = 'duke'

      // A list of image names.
      // If unspecified, a single image `{{repoOwner}}/{{distributionName}}:{{tagName}}`
      // will be created.
      //  
      imageName('{{repoOwner}}/{{distributionName}}:{{tagName}}')
      imageName('duke/app:latest')

      // A map of environment variables.
      // 
      environment('FOO', 'bar')

      // A map of OCI labels.
      // The key `openjdk@#{java.version}` will be added automatically if not defined.
      //  
      label('foo', 'bar')

      // Set of volume mount points.
      // 
      volume('/volume1')

      // Set of exposed ports metadata (port-number/protocol).
      // 
      exposedPort('123/udp')

      // A list of jib registries where images will be published.
      // 
      registries {

        // The name of the registry. Must be unique.
        // 
        myRegistry {

          // The address of the jib registry.
          // 
          server = 'ghcr.io'

          // Username for communicating with both target and base image registries.
          // Defaults to the same username as the release repository.
          //  
          username = 'duke'

          // Username for communicating with target image registry.
          //  
          toUsername = 'duke'

          // Username for communicating with base image registry.
          //  
          fromUsername = 'duke'

          // Password for communicating with both target and base image registries.
          //  
          password = '__USE_ENVIRONMENT_VARIABLE__'

          // Password for communicating with target image registry.
          //  
          toPassword = '__USE_ENVIRONMENT_VARIABLE__'

          // Password for communicating with base image registry.
          //  
          fromPassword = '__USE_ENVIRONMENT_VARIABLE__'
        }
      }
    }
  }
}

Environment

When not explicitly set, the value of the following properties may be resolved from an environment variable or a system property as shown in the table. The system property takes precedence over the environment variable.

Inside packagers section

System Property Environment Variable

active

jreleaser.packagers.jib.active

JRELEASER_PACKAGERS_JIB_ACTIVE

Inside distributions section

System Property Environment Variable

active

jreleaser.distributions.${name}.jib.active

JRELEASER_DISTRIBUTIONS_${name}_JIB_ACTIVE

registry.toUsername

jreleaser.distributions.${name}.jib.${serverName}.tousername
jreleaser.jib.${serverName}.tousername

JRELEASER_DISTRIBUTIONS_${name}_JIB_${serverName}_TOUSERNAME
JRELEASER_JIB_${serverName}_TOUSERNAME

registry.fromUsername

jreleaser.distributions.${name}.jib.${serverName}.fromusername
jreleaser.jib.${serverName}.fromusername

JRELEASER_DISTRIBUTIONS_${name}_JIB_${serverName}_FROMUSERNAME
JRELEASER_JIB_${serverName}_FROMUSERNAME

registry.username

jreleaser.distributions.${name}.jib.${serverName}.username
jreleaser.jib.${serverName}.username
jreleaser.github.username
jreleaser.gitlab.username
jreleaser.gitea.username
jreleaser.codeberg.username

JRELEASER_DISTRIBUTIONS_${name}_JIB_${serverName}_USERNAME
JRELEASER_JIB_${serverName}_USERNAME
JRELEASER_GITHUB_USERNAME
JRELEASER_GITLAB_USERNAME
JRELEASER_GITEA_USERNAME
JRELEASER_CODEBERG_USERNAME

registry.topassword

jreleaser.distributions.${name}.jib.${name}.topassword
jreleaser.jib.${name}.topassword

JRELEASER_DISTRIBUTIONS_${name}_JIB_${name}_TOPASSWORD
JRELEASER_JIB_${name}_TOPASSWORD

registry.frompassword

jreleaser.distributions.${name}.jib.${name}.frompassword
jreleaser.jib.${name}.frompassword

JRELEASER_DISTRIBUTIONS_${name}_JIB_${name}_FROMPASSWORD
JRELEASER_JIB_${name}_FROMPASSWORD

registry.password

jreleaser.distributions.${name}.jib.${name}.password
jreleaser.jib.${name}.password

JRELEASER_DISTRIBUTIONS_${name}_JIB_${name}_PASSWORD
JRELEASER_JIB_${name}_PASSWORD

repository.active

jreleaser.distributions.${name}.jib.repository.active

JRELEASER_DISTRIBUTIONS_${name}_JIB_REPOSITORY_ACTIVE

repository.username

jreleaser.distributions.${name}.jib.repository.username
jreleaser.jib.github.username
jreleaser.jib.gitlab.username
jreleaser.jib.gitea.username
jreleaser.jib.codeberg.username
jreleaser.github.username
jreleaser.gitlab.username
jreleaser.gitea.username
jreleaser.codeberg.username

JRELEASER_DISTRIBUTIONS_${name}_JIB_REPOSITORY_USERNAME
JRELEASER_JIB_GITHUB_USERNAME
JRELEASER_JIB_GITLAB_USERNAME
JRELEASER_JIB_GITEA_USERNAME
JRELEASER_JIB_CODEBERG_USERNAME
JRELEASER_GITHUB_USERNAME
JRELEASER_GITLAB_USERNAME
JRELEASER_GITEA_USERNAME
JRELEASER_CODEBERG_USERNAME

repository.token

jreleaser.distributions.${name}.jib.repository.token
jreleaser.jib.github.token
jreleaser.jib.gitlab.token
jreleaser.jib.gitea.token
jreleaser.jib.codeberg.token
jreleaser.github.token
jreleaser.gitlab.token
jreleaser.gitea.token
jreleaser.codeberg.token

JRELEASER_DISTRIBUTIONS_${name}_JIB_REPOSITORY_TOKEN
JRELEASER_JIB_GITHUB_TOKEN
JRELEASER_JIB_GITLAB_TOKEN
JRELEASER_JIB_GITEA_TOKEN
JRELEASER_JIB_CODEBERG_TOKEN
JRELEASER_GITHUB_TOKEN
JRELEASER_GITLAB_TOKEN
JRELEASER_GITEA_TOKEN
JRELEASER_CODEBERG_TOKEN

repository.branch

jreleaser.distributions.${name}.jib.repository.branch
jreleaser.jib.github.branch
jreleaser.jib.gitlab.branch
jreleaser.jib.gitea.branch
jreleaser.jib.codeberg.branch
jreleaser.github.branch
jreleaser.gitlab.branch
jreleaser.gitea.branch
jreleaser.codeberg.branch

JRELEASER_DISTRIBUTIONS_${name}_JIB_REPOSITORY_BRANCH
JRELEASER_JIB_GITHUB_BRANCH
JRELEASER_JIB_GITLAB_BRANCH
JRELEASER_JIB_GITEA_BRANCH
JRELEASER_JIB_CODEBERG_BRANCH
JRELEASER_GITHUB_BRANCH
JRELEASER_GITLAB_BRANCH
JRELEASER_GITEA_BRANCH
JRELEASER_CODEBERG_BRANCH

repository.branchPush

jreleaser.distributions.${name}.jib.repository.branch.push
jreleaser.jib.github.branch.push
jreleaser.jib.gitlab.branch.push
jreleaser.jib.gitea.branch.push
jreleaser.jib.codeberg.branch.push
jreleaser.github.branch.push
jreleaser.gitlab.branch.push
jreleaser.gitea.branch.push
jreleaser.codeberg.branch.push

JRELEASER_DISTRIBUTIONS_${name}_JIB_REPOSITORY_BRANCH_PUSH
JRELEASER_JIB_GITHUB_BRANCH_PUSH
JRELEASER_JIB_GITLAB_BRANCH_PUSH
JRELEASER_JIB_GITEA_BRANCH_PUSH
JRELEASER_JIB_CODEBERG_BRANCH_PUSH
JRELEASER_GITHUB_BRANCH_PUSH
JRELEASER_GITLAB_BRANCH_PUSH
JRELEASER_GITEA_BRANCH_PUSH
JRELEASER_CODEBERG_BRANCH_PUSH

Substitute ${name} for the value of the named instance.

Space (' '), underscore (_), and dash (-) will be replaced by dot (.) to separate tokens in the System property. Space (' '), dash (-), and dot (.) will be replaced by underscore (_) to separate tokens in the environment variable, such that:

${name} System Property Environment Variable

foobar

foobar

FOOBAR

fooBar

foobar

FOOBAR

foo bar

foo.bar

FOO_BAR

foo-bar

foo.bar

FOO_BAR

foo_bar

foo.bar

FOO_BAR

foo.bar

foo.bar

FOO_BAR

Tokens

The repository token environment variable must match with the chosen Release service.

On GitHub, you can’t use the default secrets.GITHUB_TOKEN as this token only works for the repository that’s running the workflow. You must configure a Personal Access Token (PAT) instead. It is recommended that you use "fine-grained" PATs, rather than "classic" ones. The token must have:

  • Access to your tap repository; if this repository is part of a GitHub organization, make sure to choose that organization as the resource owner; if that organization doesn’t show up in the "resource owner" drop-down, contact your organization adminstrator and ask them to enable PAT access for that repository

  • The "Contents read and write" repository permission

DownloadURL

JReleaser follows these rules to find the download URL to use for a given artifact:

  1. if artifact.extraProperties.jibDownloadUrl exists, use it.

  2. if artifact.extraProperties.downloadUrl exists, use it.

  3. if explicit downloadUrl is set on jib, use it.

  4. if distribution.extraProperties.jibDownloadUrl exists, use it.

  5. if distribution.extraProperties.downloadUrl exists, use it.

  6. if releaser.${release}.skipRelease is false then use the releaser’s downloadUrl.

  7. if releaser.${release}.skipRelease is true then look for a matching uploader given an extraProperty named downloadUrlFrom on artifact, distribution, `jib (in that order). The value must be <uploaderType>:<uploaderName> such as "artifactory:app" or "s3:uploads".

  8. fail if no suitable URL is found.

With no extra configuration from your side rule 6. will be chosen which is the suitable default that most projects need.

Usernames/Passwords

You must define values for both toUsername and toPassword properties on a given registry, at the bare minimum. If username and password are defined then other properties will be ignored.

Example

Assuming the current version is 1.2.3, and a distribution named app, the above configuration will generate a build file like the following one:

apiVersion: jib/v1alpha1
kind: BuildFile

from:
  image: azul/zulu-openjdk-alpine:11-jre

format: Docker

labels:
  "org.opencontainers.image.description": "App"
  "org.opencontainers.image.licenses": "APACHE-2.0"
  "org.opencontainers.image.revision": "8b592aa0103670b10d2f767481189684ca621c69"
  "org.opencontainers.image.title": "app"
  "org.opencontainers.image.url": "https://github.com/duke/app"
  "org.opencontainers.image.version": "1.2.3"

workingDirectory: "/workspace"

entrypoint: ["/workspace/app-1.2.3/bin/app"]

layers:
  entries:
    - name: app
      files:
        - src: assembly/app-1.2.3/bin
          dest: /workspace/app-1.0.0/bin
          properties:
            filePermissions: 755
        - src: assembly/app-1.2.3
          dest: /workspace/app-1.2.3
          excludes:
            - "bin/*"
        - src: assembly
          dest: /workspace
          excludes:
            - "app-1.2.3"

Base Images

Different values for the default base image will be used depending on the distribution type:

  • azul/zulu-openjdk-alpine:#{distribution.java.version}-jre for JAVA_BINARY and SINGLE_JAR distributions.

  • ubuntu:latest for JLINK distributions when the artifact has a linux platform.

  • alpine:latest for JLINK distributions when the artifact has a linux_musl platform.

  • scratch for NATIVE_IMAGE distributions.

Default Labels

JReleaser will add the following labels if they are not explicitly defined:

  • org.opencontainers.image.title = {{distributionName}}

  • org.opencontainers.image.description = {{projectDescription}}

  • org.opencontainers.image.url = {{projectLinkHomepage}}

  • org.opencontainers.image.licenses = {{projectLicense}}

  • org.opencontainers.image.version = {{projectVersion}}

  • org.opencontainers.image.revision = {{commitFullHash}}

You may use any Name Templates as part of the label value.

Prerelease Image Names

A different set of images names will be automatically configured when the project is snapshot, to avoid possible clashes with production images.

JReleaser will look for the first image name that ends with :{{tagName}} and discard the rest.

It will use {{repoOwner}}/{{distributionName}}:{{tagName}} if no matching image name is found.

Keeping images updated for current major

Some users might want to when version to push jib tags :v1, :v1.6, :v1.6.4 and :latest when v1.6.4 (for example) is built. That can be accomplished by using multiple image names:

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

project:
  name: app

packagers:
  jib:
    active: ALWAYS
    imageNames:
    - "myuser/myimage:{{tagName}}"
    - "myuser/myimage:v{{projectVersionMajor}}"
    - "myuser/myimage:v{{projectVersionMajor}}.{{projectVersionMinor}}"
    - "myuser/myimage:latest"
[project]
  name = "app"

[packagers.jib]
  active = "ALWAYS"
  imageNames = [
    "myuser/myimage:{{tagName}}",
    "myuser/myimage:v{{projectVersionMajor}}",
    "myuser/myimage:v{{projectVersionMajor}}.{{projectVersionMinor}}",
    "myuser/myimage:latest"]
{
  "project": {
    "name": "app"
  },

  "packagers": {
    "jib": {
      "active": "ALWAYS",
      "imageNames": [
        "myuser/myimage:{{tagName}}",
        "myuser/myimage:v{{projectVersionMajor}}",
        "myuser/myimage:v{{projectVersionMajor}}.{{projectVersionMinor}}",
        "myuser/myimage:latest"
      ]
    }
  }
}
<!-- project.artifactId = app -->
<jreleaser>
  <packagers>
    <jib>
      <active>ALWAYS</active>
      <imageNames>
        <imageName>myuser/myimage:{{tagName}}</imageName>
        <imageName>myuser/myimage:v{{projectVersionMajor}}</imageName>
        <imageName>myuser/myimage:v{{projectVersionMajor}}.{{projectVersionMinor}}</imageName>
        <imageName>myuser/myimage:latest</imageName>
      </imageNames>
    </jib>
  </packagers>
</jreleaser>
// project.name = app
jreleaser {
  packagers {
    jib {
      active = 'ALWAYS'
      imageName('myuser/myimage:{{tagName}}')
      imageName('myuser/myimage:v{{projectVersionMajor}}')
      imageName('myuser/myimage:v{{projectVersionMajor}}.{{projectVersionMinor}}')
      imageName('myuser/myimage:latest')
    }
  }
}

This will build the following images:

  • myuser/myimage:v1.6.4

  • myuser/myimage:v1

  • myuser/myimage:v1.6

  • myuser/myimage:latest

Additional Files

Any files placed inside #{jib.templateDirectory}/assembly will be copied into the container at the root.

Multiple build files per Distribution

The previous sections explain how a single or multiple Jib images may be created for a single distribution using the same build.yml file. However, should you need to use several build files with the same distribution then just add a specs section and configure each spec to your liking. Each spec takes the same arguments as the jib section plus an extra element named matchers that determines which distribution artifact should be used with that particular spec.

Matchers are key/value pairs that can match the artifact’s platform property and any of its extraProperties.

This feature is useful when paired with an assembled Jlink distribution that defines more than one artifact that may be packaged with Jib. The following example handles the case of generating cross-platform Java Runtimes with Jlink; there are 2 artifacts (the linux variants) that may be distributed with Jib, each one requiring different settings:

  • YAML

environment:
  properties:
    jdkPathPrefix: 'target/jdks'
    jdkFilePrefix: 'zulu17.32.13-ca-jdk17.0.2'

project:
  name: helloworld
  description: HelloWorld in Java
  longDescription: HelloWorld in Java
  links:
    homepage: https://github.com/jreleaser/helloworld-java-jlink
  authors:
    - Andres Almiray
  license: APACHE-2.0
  inceptionYear: 2023
  stereotype: CLI
  java:
    version: 11
    groupId: org.jreleaser.examples
    artifactId: helloworld
    mainClass: org.jreleaser.examples.HelloWorld

release:
  github:
    overwrite: true
    changelog:
      formatted: ALWAYS
      preset: conventional-commits
      contributors:
        format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'

assemble:
  jlink:
    helloworld:
      active: ALWAYS
      imageName: '{{distributionName}}-{{projectVersion}}'
      targetJdks:
        - path: '{{jdkPathPrefix}}/zulu17OsxIntel/{{jdkFilePrefix}}-macosx_x64/zulu-17.jdk/Contents/Home'
          platform: 'osx-x86_64'
        - path: '{{jdkPathPrefix}}/zulu17OsxArm/{{jdkFilePrefix}}-macosx_aarch64/zulu-17.jdk/Contents/Home'
          platform: 'osx-aarch_64'
        - path: '{{jdkPathPrefix}}/zulu17LinuxIntel/{{jdkFilePrefix}}-linux_x64'
          platform: 'linux-x86_64'
        - path: '{{jdkPathPrefix}}/zulu17LinuxMuslIntel/{{jdkFilePrefix}}-linux_musl_x64'
          platform: 'linux_musl-x86_64'
        - path: '{{jdkPathPrefix}}/zulu17LinuxArm/{{jdkFilePrefix}}-linux_aarch64'
          platform: 'linux-aarch_64'
        - path: '{{jdkPathPrefix}}/zulu17WindowsIntel/{{jdkFilePrefix}}-win_x64'
          platform: 'windows-x86_64'
        - path: '{{jdkPathPrefix}}/zulu17WindowsArm/{{jdkFilePrefix}}-win_aarch64'
          platform: 'windows-aarch_64'
      mainJar:
        path: 'target/{{distributionName}}-{{projectVersion}}.jar'

packagers:
  jib:
    active: ALWAYS
    registries:
      - name: github
        server: ghcr.io

distributions:
  # name must match!
  helloworld:
    jib:
      # configure 2 specs
      specs:
        slim:
          imageNames:
            - 'duke/{{distributionName}}-{{jibSpecName}}:{{tagName}}'
            - 'duke/{{distributionName}}-{{jibSpecName}}:latest'
          matchers:
            # match by platform
            platform: 'linux-x86_64'
        alpine:
          imageNames:
            - 'duke/{{distributionName}}-{{jibSpecName}}:{{tagName}}'
            - 'duke/{{distributionName}}-{{jibSpecName}}:latest'
          matchers:
            # match by platform
            platform: 'linux_musl-x86_64'

This generates two different images:

  • duke/helloworld-slim:<tag> with ubuntu:latest as base image. Packages helloworld-standalone-<version>-linux.zip because of the matching platform.

  • duke/helloworld-alpine:<tag> with alpine:latest as base image. Packages helloworld-standalone-<version>-linux_musl.zip because of the matching platform.

Templates

The default location for templates is:

src/jreleaser/distributions/<distribution-name>/jib

The default location for spec templates is:

src/jreleaser/distributions/<distribution-name>/jib/<spec>

You may place common files to all specs at

src/jreleaser/distributions/<distribution-name>/jib/ROOT

The following list shows the filenames that may be used to override default templates:

  • build.yml.tpl

Any additional files found in the template directories will be copied as is unless their filename ends with .tpl in which case Name Templates substitution will take place.

Templates may be initialized using the template command

Skip Templates

You may skip any template files by defining a set of skip rules in the skipTemplates property. For example, you may use any of these expressions to skip a template named README.md.tpl:

  • README.md.tpl: matches the full template name

  • README.md: matches the transformed template name

  • README.*: matches using a regex

Skip Artifacts

If there is more than one matching artifact in a given distribution you may add a skipJib extra property to the target artifact to mark it as skipped for packaging with jib.

Skip License

If there’s a matching LICENSE file available at the root of the project it will be copied to the repository by default. You may set an extra property named skipLicenseFile on jib to skip this behavior.

Repository

The repository section allows setting extra properties that may be used to provide additional hints when interacting with the git repository that holds packager files.

GitLab

Define a projectIdentifier property to directly locate the project associated with the repository, such as

  • YAML

  • TOML

  • JSON

  • Maven

  • Gradle

packagers:
  jib:
    repository:
      extraProperties:
        projectIdentifier: 12345678
[packagers.jib]
  repository.extraProperties.projectIdentifier = "12345678"
{
  "packagers": {
    "jib": {
      "repository": {
        "extraProperties": {
          "projectIdentifier": "12345678"
        }
      }
    }
  }
}
<jreleaser>
  <packagers>
    <jib>
      <repository>
        <extraProperties>
          <projectIdentifier>12345678</projectIdentifier>
        </extraProperties>
      </repository>
    </jib>
  </packagers>
</jreleaser>
jreleaser {
  packagers {
    jib {
      repository {
        extraProperties.put("projectIdentifier", "12345678")
      }
    }
  }
}