forked from CESNET/ipfixprobe
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.71 KB
/
stage0.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
name: prepare
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
build_docker_image:
runs-on: ubuntu-latest
strategy:
matrix:
os: [oraclelinux-9, oraclelinux-8, rockylinux-8]
steps:
- uses: actions/checkout@v3
- name: set lower case owner name
run: |
echo "ACTOR_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.actor }}'
- name: IMAGE OS info
run: echo ${{ matrix.os }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_LOGIN }}
- name: Extract metadata (tags, labels) for Docker
run: |
IFS=- read -r OS_NAME OS_TAG <<< ${{ matrix.os }}
echo "${{ matrix.os }}_OS_NAME=$OS_NAME" >>${GITHUB_ENV}
echo "${{ matrix.os }}_OS_TAG=$OS_TAG" >>${GITHUB_ENV}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
build-args: |
OS_DISTRO=${{ env[format('{0}_OS_NAME', matrix.os)] }}
OS_RELEASE=${{ env[format('{0}_OS_TAG', matrix.os)] }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.ACTOR_LC }}/${{ env[format('{0}_OS_NAME', matrix.os)] }}:${{ env[format('{0}_OS_TAG', matrix.os)] }}
cache-from: type=gha,scope=build-${{ matrix.os }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.os }}