sd #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ghcr.io/siskapavel/${{ env[format('{0}_OS_NAME', matrix.os)] }}:${{ env[format('{0}_OS_TAG', matrix.os)] }} | |
#${{ env.REGISTRY }}/${{ env.LC_ACTOR }}/${{ env[format('{0}_OS_NAME', matrix.os)] }}:${{ env[format('{0}_OS_TAG', matrix.os)] }} | |
target: ${{ matrix.os }} | |
cache-from: type=gha,scope=build-${{ matrix.os }} | |
cache-to: type=gha,mode=max,scope=build-${{ matrix.os }} |