-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (116 loc) · 3.69 KB
/
image_creator.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: 'Image Creator'
on:
# A executer que lorsque l'on demande.
workflow_dispatch:
inputs:
os_base:
description: 'OS base'
required: true
default: 'ubuntu-2404'
type: choice
options:
- 'ubuntu-2404'
- 'ubuntu-2204'
- 'ubuntu-2004'
compiler:
description: 'Compiler'
required: true
default: 'gcc-14'
type: choice
options:
- 'gcc-14'
- 'gcc-12'
- 'gcc-11'
- 'clang-18'
- 'clang-15'
- 'clang-14'
- 'clang-13'
- 'cuda-120'
- 'cuda-118'
- 'cuda-117'
- 'cuda-116'
dependencies:
description: 'Dependencies'
required: true
default: 'full'
type: choice
options:
- 'full'
- 'minimal'
- 'doc'
build_type:
description: 'Build type'
required: true
default: 'release'
type: choice
options:
- 'release'
- 'debug'
- 'check'
dockerfile_only:
description: 'Generate only the Dockerfile (upload as artifact)'
required: true
type: boolean
env:
REGISTRY: 'ghcr.io'
USER_NAME: 'arcaneframework'
DOCKERFILE_IN: './.github/scripts/Dockerfile.in'
DOCKERFILE_OUT: './Dockerfile'
jobs:
build-and-push:
name: Build and Push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate Dockerfile
shell: 'bash'
run: |
./.github/scripts/DockerfileGenerator.sh \
--os ${{ inputs.os_base }} \
--compiler ${{ inputs.compiler }} \
--image_version ${{ inputs.dependencies }} \
--build_type ${{ inputs.build_type }} \
--dockerfile_in ${{ env.DOCKERFILE_IN }} \
--dockerfile_out ${{ env.DOCKERFILE_OUT }}
- name: Log in to the Container registry
uses: docker/login-action@v3
if: ${{ ! inputs.dockerfile_only }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
if: ${{ ! inputs.dockerfile_only }}
with:
images: ${{ env.REGISTRY }}/${{ env.USER_NAME }}/arcane_${{ inputs.os_base }}
labels: |
org.opencontainers.image.title=ArcaneFramework
org.opencontainers.image.description=Arcane Framework Image
org.opencontainers.image.vendor=CEA
tags: |
type=raw, ${{ inputs.compiler }}_${{ inputs.dependencies }}_${{ inputs.build_type }}_latest
type=raw, ${{ inputs.compiler }}_${{ inputs.dependencies }}_${{ inputs.build_type }}_{{date 'YYYYMMDD'}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
if: ${{ ! inputs.dockerfile_only }}
with:
context: .
file: ${{ env.DOCKERFILE_OUT }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Display error
if: ${{ failure() }}
run: echo "::error::Base image unknown, see available images here https://github.com/arcaneframework/framework-ci#images-disponibles"
- name: Upload Dockerfile generated
uses: actions/upload-artifact@v4
with:
name: arcane_${{ inputs.os_base }}_${{ inputs.compiler }}_${{ inputs.dependencies }}_${{ inputs.build_type }}_dockerfile
path: ${{ env.DOCKERFILE_OUT }}
retention-days: 7