GitHub Actions gives you the flexibility to build automated software development workflows. With GitHub Actions for Okteto you can create workflows to build, deploy and update your applications in Okteto.
Try Okteto for free for 30 days, no credit card required. Start your 30-day trial now!
You can use this action to build images from an Okteto Manifest.
Name and optionally a tag in the name:tag format for the build. When file points to a Dockerfile, in order to push the image to a registry, a tag is required. Otherwise, the build would be done but no image will be pushed to the registry.
The relative path to the Okteto Manifest.
You can also use this input to point to a Dockerfile. In this mode, okteto build will ignore your Okteto manifest, and directly build the image defined in the Dockerfile. Use this to build images that are not defined on your Okteto manifest.
Service from the Okteto Manifest to build. You can select the service to build providing the path, otherwise all images at the Okteto Manifest build definition would be build.
When repository does not have an Okteto Manifest or Dockerfile is provided at file, path is the execution path of the action. .
A list of comma-separated build arguments.
Specific target stage to build image. Only available when file refers to a Dockerfile instead of an Okteto Manifest.
Set to "true" when no cache should be used when building the image
A list of comma-separated images where cache should be imported from. Specific target stage to build image. Only available when file refers to a Dockerfile instead of an Okteto Manifest.
A list of comma-separated images where cache should be exported to.
A list of semi-colon secrets. Each with format: id=mysecret,src=/local/secret. Specific target stage to build image. Only available when file refers to a Dockerfile instead of an Okteto Manifest.
A list of semi-colon target platforms to build
Log level used. Supported values are: debug, info, warn, error. (defaults to warn)
This example runs the context action okteto/context@latest and then builds and pushes an image. A valid Okteto Manifest should exist at the repository.
# File: .github/workflows/workflow.yml
on: [push]
name: example
concurrency:
# more info here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
devflow:
runs-on: ubuntu-latest
steps:
- uses: okteto/context@latest
with:
url: https://okteto.example.com
token: ${{ secrets.OKTETO_TOKEN }}
- name: "Build"
uses: okteto/build@latestThis example runs the context action okteto/context@latest and then builds and pushes the image for the service service. A valid Okteto Manifest should exist at the repository.
# File: .github/workflows/workflow.yml
on: [push]
name: example
jobs:
devflow:
runs-on: ubuntu-latest
steps:
- name: "Context Setup"
uses: okteto/context@latest
with:
url: https://okteto.example.com
token: ${{ secrets.OKTETO_TOKEN }}
- name: "Build"
uses: okteto/build@latest
with:
path: serviceThis example sets the context, and then builds an image that is not defined in the Okteto Manifest.
# File: .github/workflows/workflow.yml
on: [push]
name: example
jobs:
devflow:
runs-on: ubuntu-latest
steps:
- name: "Context Setup"
uses: okteto/context@latest
with:
url: https://okteto.example.com
token: ${{ secrets.OKTETO_TOKEN }}
- name: "Build"
uses: okteto/build@latest
with:
tag: myapp-backend:latest
file: Dockerfile
path: backendIf tag is not provided, the image won't be pushed to the registry.
You can specify a custom certificate authority or a self-signed certificate by setting the OKTETO_CA_CERT environment variable. When this variable is set, the action will install the certificate in the container, and then execute the action.
Use this option if you're using a private Certificate Authority or a self-signed certificate in your Okteto SH instance. We recommend that you store the certificate as an encrypted secret, and that you define the environment variable for the entire job, instead of doing it on every step.
# File: .github/workflows/workflow.yml
on: [push]
name: example
jobs:
devflow:
runs-on: ubuntu-latest
env:
OKTETO_CA_CERT: ${{ secrets.OKTETO_CA_CERT }}
steps:
- name: checkout
uses: actions/checkout@master
- name: "Context Setup"
uses: okteto/context@latest
with:
url: https://okteto.example.com
token: ${{ secrets.OKTETO_TOKEN }}
- name: "Build"
uses: okteto/build@latest