Skip to content

Merge pull request #2 from ObolNetwork/anadi/create-image #2

Merge pull request #2 from ObolNetwork/anadi/create-image

Merge pull request #2 from ObolNetwork/anadi/create-image #2

name: Publish Images
on:
push:
branches: [main]
tags: [v*]
paths:
- .github/workflows/publish-images.yml
- services/**
- centaur_sdk/**
- packages/**
- tools/**
- scripts/bootstrap-k8s-secrets.sh
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- .agents/skills/**
pull_request:
workflow_dispatch:
concurrency:
group: publish-images-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAMESPACE: obolnetwork/centaur # was paradigmxyz/centaur
IMAGE_SOURCE: https://github.com/ObolNetwork/centaur
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- service: api
image: centaur-api
dockerfile: services/api/Dockerfile
target: ""
- service: slackbot
image: centaur-slackbot
dockerfile: services/slackbot/Dockerfile
target: ""
- service: agent
image: centaur-agent
dockerfile: services/sandbox/Dockerfile
target: sandbox
- service: iron-proxy
image: centaur-iron-proxy
dockerfile: services/iron-proxy/Dockerfile
target: ""
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Log in to GHCR
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata for ${{ matrix.image }}
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}
flavor: |
latest=false
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=main,enable={{is_default_branch}}
type=raw,value=edge,enable={{is_default_branch}}
type=sha,prefix=main-sha-,enable={{is_default_branch}}
type=semver,pattern={{raw}}
type=ref,event=pr
type=sha
labels: |
org.opencontainers.image.title=${{ matrix.image }}
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }}
env:
DOCKER_METADATA_PR_HEAD_SHA: true
- name: Build and push ${{ matrix.image }}
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: ${{ matrix.dockerfile }}
target: ${{ matrix.target }}
push: ${{ !github.event.pull_request.head.repo.fork }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,mode=max,scope=${{ matrix.image }}