Skip to content

Merge pull request #3 from maurijr-42/main #10

Merge pull request #3 from maurijr-42/main

Merge pull request #3 from maurijr-42/main #10

Workflow file for this run

name: Docker Image
on:
push:
branches: [main]
tags: ["v*"]
paths:
- "Dockerfile.mlips"
- ".dockerignore"
- "pyproject.toml"
- "ip_orch/**"
- "examples/**"
- ".github/workflows/docker.yml"
pull_request:
paths:
- "Dockerfile.mlips"
- ".dockerignore"
- "pyproject.toml"
- "ip_orch/**"
- "examples/**"
- ".github/workflows/docker.yml"
workflow_dispatch:
inputs:
mace_ref:
description: "MACE git ref to build"
required: false
default: "main"
orb_ref:
description: "Orb git ref to build"
required: false
default: "v0.5.5"
push_image:
description: "Push image to GHCR"
required: false
type: boolean
default: false
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || inputs.push_image)
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and optionally push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.mlips
platforms: linux/amd64
push: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_image) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
MACE_REF=${{ inputs.mace_ref || 'main' }}
ORB_REF=${{ inputs.orb_ref || 'v0.5.5' }}
cache-from: type=gha
cache-to: type=gha,mode=max