Using a Docker Image for Pipelines in Kubernetes

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

The Helm deploy will pull an image from a Docker registry to orchestrate to a Kubernetes cluster.

You may wish to build the Docker image and push it to the registry as part of your pipeline. If so, you can use the DockerBuildand DockerPushnative steps.

If your image to deploy is already available in the Docker registry, then you can skip this procedure. However, you will still need an Imageresource that specifies the image in the registry.

Ourresourcesdefinitions will specify:

  • simplehelmRepo_docker - The GitRepo source repository where the Dockerfile is stored

  • simplehelmDockerImage - An Image resource for the Docker image that will be built and pushed to the Docker registry in Artifactory

resources

 - name: simplehelmRepo_docker
   type: GitRepo
   configuration:
     gitProvider: my_github
     path: myrepo/simplehelm
     files:
       include: "Dockerfile|server.js|package.json"

 - name: simplehelmDockerImage
   type: Image
   configuration:
     registry: myDocker
     imageName: myproject/simplehelm
     imageTag: latest 

Using these resources, the pipeline will build the Docker image and push it to a registry in Artifactory.

steps

pipelines:
   - name: pipelines name
     steps:
      - name: build_image
        type: DockerBuild
        configuration:
          affinityGroup: buildAndPush
          integrations:
            - name: myDocker
          inputResources:
            - name: simplehelmRepo_docker
          dockerFileLocation: .
          dockerFileName: Dockerfile
          dockerImageName: myproject/simplehelm
          dockerImageTag: $run_number

      - name: push_image
        type: DockerPush
        configuration:
          affinityGroup: buildAndPush
          integrations:
            - name: myDocker
          targetRepository: myproject/simplehelm
          inputSteps:
            - name: build_image
          outputResources:
            - name: simplehelmDockerImage