Skip to content

Commit

Permalink
initial action commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 9, 2022
1 parent 3d75022 commit dc07d6a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
76 changes: 76 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Bento Build"
description: "Composite GitHub action for building Bento images"
inputs:
container-name:
description: "Container name"
required: true
development-dockerfile:
description: "Development Dockerfile path"
required: true
default: "dev.Dockerfile"
production-dockerfile:
description: "Production Dockerfile path"
required: true
default: "Dockerfile"
runs:
using: "composite"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log into the container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up development image metadata
id: meta-dev
uses: docker/metadata-action@v4
with:
images: |
${{ inputs.container-name }}
flavor: |
latest=false
tags: |
type=raw,value=latest-dev,enable={{is_default_branch}}
type=ref,event=pr
type=sha,prefix=sha-
- name: Build and push development image
uses: docker/build-push-action@v3
with:
context: .
file: ${{ inputs.development-dockerfile }}
push: true
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
platforms: linux/amd64,linux/arm64

- name: Set up production image metadata
id: meta
uses: docker/metadata-action@v4
if: ${{ github.event_name == 'release' }}
with:
images: |
${{ inputs.container-name }}
flavor: |
latest=true
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push production image
uses: docker/build-push-action@v3
if: ${{ github.event_name == 'release' }}
with:
context: .
file: ${{ inputs.production-dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

0 comments on commit dc07d6a

Please sign in to comment.