Skip to content

MSE docker build

MSE docker build #24

Workflow file for this run

name: MSE docker build
on:
workflow_dispatch:
inputs:
version:
description: 'Release ("") or beta ("-beta")?'
required: false
default: ""
type: choice
options:
- ""
- "-beta"
docker:
description: "Which docker (default=all)?"
required: false
type: choice
default: "all"
options:
- "all"
- "mse-anonymization"
- "mse-tensorflow"
- "mse-fastapi"
- "mse-flask"
- "mse-ds"
- "mse-nlp"
env:
REGISTRY: ghcr.io
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
include:
- directory: "data_anonymization_s3"
image: "ghcr.io/cosmian/mse-anonymization${{ inputs.version }}"
- directory: "digit_recognition"
image: "ghcr.io/cosmian/mse-tensorflow${{ inputs.version }}"
- directory: "fastapi_helloworld"
image: "ghcr.io/cosmian/mse-fastapi${{ inputs.version }}"
- directory: "helloworld"
image: "ghcr.io/cosmian/mse-flask${{ inputs.version }}"
- directory: "merge_join"
image: "ghcr.io/cosmian/mse-ds${{ inputs.version }}"
- directory: "sentiment_analysis"
image: "ghcr.io/cosmian/mse-nlp${{ inputs.version }}"
steps:
- name: Build date
id: build_date
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
run: |
echo "BUILD_DATE=$(date -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Checkout
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
uses: actions/checkout@v3
- name: Login to GitHub Packages
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildx
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
uses: docker/setup-buildx-action@v2
- name: Build and push
if: ${{ (inputs.docker == 'all') || contains(matrix.image, inputs.docker) }}
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:${{ matrix.directory }}"
push: true
tags: |
${{ matrix.image }}:${{ github.sha }}
${{ matrix.image }}:${{ steps.build_date.outputs.BUILD_DATE }}
labels: ${{ steps.meta.outputs.labels }}