Skip to content

Build and publish Firefly image #3

Build and publish Firefly image

Build and publish Firefly image #3

Workflow file for this run

name: Build and publish Firefly image
on:
workflow_dispatch:
inputs:
git_tag:
description: "Git tag to use(e.g. 'release-xxxx.x.x' or a full git tag)"
required: true
type: string
img_tag:
description: "Optional: Docker image tag(e.g. 'xxxx.x.x'); If omitted, `git_tag` will be used."
required: false
type: string
push_image:
description: "Push image to GHCR"
required: false
default: false
type: boolean
release:
types: [published]
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
# ------------------------------------------------------------
# Checkout firefly (this repo)
# ------------------------------------------------------------
- name: Checkout Firefly
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_tag }}
path: firefly
# -------------------------------------------------------------
# Use local action to resolve git ref and image tag from inputs
# -------------------------------------------------------------
- name: Resolve tags
id: resolve_tag
uses: ./firefly/.github/actions/resolve-tag
with:
git_tag: ${{ inputs.git_tag }}
img_tag: ${{ inputs.img_tag }}
# ------------------------------------------------------------
# Checkout Firefly online help
# ------------------------------------------------------------
- name: Checkout Firefly Help
uses: actions/checkout@v4
with:
repository: Caltech-IPAC/firefly-help
ref: master
path: firefly-help
# ------------------------------------------------------------
# Setup Docker multi-platform build
# ------------------------------------------------------------
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# ------------------------------------------------------------
# Login to GHCR (only if pushing)
# ------------------------------------------------------------
- name: Login to GHCR
if: github.event_name == 'release' || inputs.push_image
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# ------------------------------------------------------------
# Build (and optionally push) multi-platform image
# ------------------------------------------------------------
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: firefly/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'release' || inputs.push_image == 'true' }}
# docker buildx does not allow uppercase letters in tags, so we convert to lowercase here
tags: ghcr.io/caltech-ipac/firefly:${{ steps.resolve_tag.outputs.tag }}
build-args: |
env=ops
cache-from: type=gha
cache-to: type=gha,mode=max