Skip to content

Replaced doc image #141

Replaced doc image

Replaced doc image #141

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:
push:
branches: [ "master" ]
env:
# Use docker.io for Docker Hub if empty
# github.repository as <account>/<repo>
REGISTRY: docker.io
REPO: mercureimaging
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# REGISTRY: ghcr.io
# REPO: ${{ github.repository_owner }}
# USERNAME: ${{ github.actor }}
# TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-mra-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: gravis-imaging/gravis
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@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@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta-base
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.REPO }}/gravis-processing-mra
tags: |
# set latest tag for default branch
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
# 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
id: build-and-push
uses: docker/build-push-action@v4
with:
context: ./processing/mra
file: ./processing/mra/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max