Skip to content

Build and Push Docker Images #56

Build and Push Docker Images

Build and Push Docker Images #56

Workflow file for this run

name: Build and Push Docker Images
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build (optional)'
required: false
push:
branches:
- 'Master'
paths:
- Dockerfile
jobs:
build_and_push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
env:
LATEST_VERSION: v1.11.7 # Determines :latest tag
strategy:
fail-fast: false
matrix:
version:
- v1.11.5
- v1.11.6
- v1.11.7
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || 'refs/heads/Master' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Prepare tags
id: prep_tags
shell: bash
run: |
if [[ "${{ matrix.version }}" == "${{ env.LATEST_VERSION }}" ]]; then
TAGS="ghcr.io/blueprintframework/blueprint:latest ghcr.io/blueprintframework/blueprint:${{ matrix.version }}"
else
TAGS="ghcr.io/blueprintframework/blueprint:${{ matrix.version }}"
fi
echo "VERSION_TAG=${{ matrix.version }}" >> $GITHUB_ENV
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.TAGS }}
build-args: VERSION_TAG=${{ env.VERSION_TAG }}