Skip to content

Create and publish Docker image #32

Create and publish Docker image

Create and publish Docker image #32

Workflow file for this run

name: Create and publish Docker image
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
workflow_dispatch:
push:
branches:
- '**'
pull_request:
types:
- closed
branches:
- develop
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
image_tags: ${{ steps.meta.outputs.tags }}
image_labels: ${{ steps.meta.outputs.labels }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get Version
id: get-version
uses: beaconbrigade/[email protected]
with:
path: .
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=edge
type=raw,value=canary,enable=${{ contains(github.event.head_commit.message, 'build_image') }}
type=raw,value=latest,enable=${{ github.event.pull_request.merged == true }}
type=semver,pattern={{version}},value=${{ steps.get-version.outputs.version }},enable=${{ github.event.pull_request.merged == true || contains(github.event.head_commit.message, 'build_image') }}
build-prod-image:
if: ${{ github.event.pull_request.merged == true }}
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: prod.Dockerfile
image_tags: ${{ needs.metadata.outputs.tags }}
image_labels: ${{ needs.metadata.outputs.labels }}
push: true
build-canary-image:
if: ${{ contains(github.event.head_commit.message, 'build_image') || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: Dockerfile
image_tags: ${{ needs.metadata.outputs.tags }}
image_labels: ${{ needs.metadata.outputs.labels }}
push: true
build-edge-image:
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: Dockerfile
image_tags: ${{ needs.metadata.outputs.image_tags }}
image_labels: ${{ needs.metadata.outputs.image_labels }}
push: true