Skip to content

Build Grazer [Private] #32

Build Grazer [Private]

Build Grazer [Private] #32

Workflow file for this run

name: Build Grazer [Private]
on:
workflow_dispatch:
inputs:
tag:
type: string
required: true
description: Tag for the built image artifact. For building the cluster image, this tag must previously exist for the base image.
dockerfile:
type: choice
required: false
description: The target Dockerfile to build. To build the cluster image, selected grazer tags get prefixed with `cluster-`
options:
- Dockerfile
- Dockerfile.cluster
jobs:
build_grazer:
name: build_grazer
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: derive_tag
run: |
if [[ "${{inputs.dockerfile}}" == *".cluster" ]]; then
echo "RELEASE_TAG=cluster-${{inputs.tag}}" >> $GITHUB_ENV;
else
echo "RELEASE_TAG=${{inputs.tag}}" >> $GITHUB_ENV;
fi
- name: setup_qemu.manifest
if: ${{ inputs.build_manifest }}
uses: docker/setup-qemu-action@v2
- name: setup_qemu.single
if: ${{ !inputs.build_manifest }}
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64
- name: setup_buildx_manifest
uses: docker/setup-buildx-action@v2
if: ${{ inputs.build_manifest }}
with:
platforms: linux/amd64,linux/arm64
- name: setup_buildx_single
uses: docker/setup-buildx-action@v2
if: ${{ !inputs.build_manifest }}
with:
driver: docker
- name: configure_aws_credentials
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ECR_ASSUME_ROLE }}
role-external-id: grazebuilder
role-duration-seconds: 1200
role-session-name: grazebuild
role-skip-session-tagging: true
aws-region: ${{ secrets.CONTAINER_REGION }}
- name: login_to_ecr
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: "false"
- name: build_and_push.manifest
uses: docker/build-push-action@v4
if: ${{ inputs.build_manifest }}
with:
file: ${{inputs.dockerfile}}
context: .
no-cache: true
push: true
tags: |
${{secrets.CONTAINER_REPO}}:${{env.RELEASE_TAG}}
builder: ${{ steps.setup_buildx_manifest.name }}
platforms: linux/amd64, linux/arm64
build-args: |
GRAZER_REPO=${{ secrets.CONTAINER_REPO }}
GRAZER_TAG=${{ inputs.tag }}
- name: build_and_push.single
if: ${{ !inputs.build_manifest}}
uses: docker/build-push-action@v4
with:
file: ${{inputs.dockerfile}}
builder: ${{ steps.setup_buildx_single.name }}
context: .
no-cache: true
push: true
tags: |
${{secrets.CONTAINER_REPO}}:${{env.RELEASE_TAG}}
build-args: |
GRAZER_REPO=${{ secrets.CONTAINER_REPO }}
GRAZER_TAG=${{ inputs.tag }}
- name: discord_notify_hook
uses: stegzilla/discord-notify@v2
with:
webhook_url: ${{ secrets.DEV_CHANNEL_DISCORD_WEBHOOK }}
title: "Grazer `${{ inputs.tag }}` Built and Pushed"
message: "**Download: ${{secrets.CONTAINER_REPO}}:${{env.RELEASE_TAG}}**"
include_image: true
custom_image_url: https://avatars.githubusercontent.com/u/196731666?s=400&v=4
avatar_url: https://avatars.githubusercontent.com/u/196731666?s=48&v=4
username: Graze Deploy Bot
colour: "#0090ff"