Skip to content

Docker

Docker #30

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_dispatch:
inputs:
recipes_branch:
description: 'Arcaneframework recipes branch'
required: true
default: 'main'
tag_name:
description: 'Tag name for image'
required: true
default: 'latest'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
config:
- {
name: "alien-spack-ubuntu20.04",
base_image: "ubuntu:20.04",
spack_version: "0.19.0",
}
- {
name: "alien-spack-ubuntu22.04",
base_image: "ubuntu:22.04",
spack_version: "0.19.0",
}
- {
name: "alien-spack-alma8",
base_image: "almalinux:8",
spack_version: "0.19.0",
}
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/arcaneframework/${{ matrix.config.name }}
labels: |
org.opencontainers.image.title=ArcaneFramework
org.opencontainers.image.description=Arcane Framework Spack Image
org.opencontainers.image.vendor=CEA
tags: |
type=raw, ${{ github.event.inputs.tag_name }}
type=raw, ${{ github.event.inputs.tag_name }}-{{date 'YYYYMMDD'}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: spack
build-args: |
BASEIMAGE=${{ matrix.config.base_image }}
SPACK_VERSION=${{ matrix.config.spack_version }}
RECIPES_BANCH=${{ github.event.inputs.recipes_branch }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}