Blueprints

Build a Docker image and push it to GitHub Container Registry (ghcr.io)

Source

yaml
id: build-github-container-image
namespace: company.team

tasks:
  - id: build
    type: io.kestra.plugin.docker.Build
    dockerfile: |
      FROM python:3.10
      RUN pip install --upgrade pip
      RUN pip install --no-cache-dir kestra requests "polars[all]"
    tags:
      - ghcr.io/kestra/polars:latest
    push: true
    credentials:
      username: kestra
      password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"

About this blueprint

Docker Git

This flow will build a Docker image and push it to a remote container registry.

  1. The dockerfile parameter is a multiline string that contains the Dockerfile content. However, it can also be a path to a file.
  2. The tags parameter is a list of tags of the image to build. Make sure to replace the code below to match your GitHub username or organization.
  3. The push parameter is a boolean that indicates whether to push the image to GitHub Container Registry.
  4. Finally, make sure to securely store your registry credentials as secrets or environment variables.

Build

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra