This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (89 loc) · 3.05 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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 }}