8000 GitHub - rdmolony/bake-action at add-compose-guide
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rdmolony/bake-action

 
 

Repository files navigation

GitHub release GitHub marketplace Test workflow Codecov

🧪 Experimental

This repository is considered EXPERIMENTAL and under active development until further notice. It is subject to non-backward compatible changes or removal in any future version so you should pin to a specific tag/commit of this action in your workflow (i.e docker/bake-action@v1.1.3).

About

GitHub Action to use Docker Buildx Bake as a high-level build command.

Screenshot


Usage

name: ci

on:
  push:
    branches:
      - 'master'

jobs:
  bake:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        uses: docker/bake-action@master
        with:
          push: true

compose

To access the cached images from compose:

  • Set load: true so that the GitHub Actions runner can access the cached images in subsequent steps.
  • Tag the cached image with the same name as in your compose.yaml.

.github/workflows/tests.yml

name: tests

on:
  push:
    branches:
      - 'master'

jobs:
  bake:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        uses: docker/bake-action@master
        with:
          push: false
          load: true
        set: |
            web.cache-from=type=gha
            web.cache-to=type=gha
      -
        name: Test via compose
        command: docker compose run web tests

compose.yaml

services:
  web:
    build:
      context: .
    image: username/imagename
    command: echo "Test run successful!"

Note: avoid running docker compose build after docker/bake-action@master as this will rebuild the image from scratch #81

Customizing

inputs

Following inputs can be used as step.with keys

List type is a newline-delimited string

set: target.args.mybuildarg=value
set: |
  target.args.mybuildarg=value
  foo*.args.mybuildarg=value

CSV type is a comma-delimited string

targets: default,release
Name Type Description
builder String Builder instance (see setup-buildx action)
files List/CSV List of bake definition files
targets List/CSV List of bake targets
no-cache Bool Do not use cache when building the image (default false)
pull Bool Always attempt to pull a newer version of the image (default false)
load Bool Load is a shorthand f 6C74 or --set=*.output=type=docker (default false)
push Bool Push is a shorthand for --set=*.output=type=registry (default false)
set List List of targets values to override (eg: targetpattern.key=value)
source String Remote bake definition to build from

outputs

Following outputs are available

Name Type Description
metadata JSON Build result metadata

Keep up-to-date with GitHub Dependabot

Since Dependabot has native GitHub Actions support, to enable it on your GitHub repo all you need to do is add the .github/dependabot.yml file:

version: 2
updates:
  # Maintain dependencies for GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

About

GitHub Action to use Docker Buildx Bake as a high-level build command

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 82.2%
  • Dockerfile 10.8%
  • HCL 7.0%
0