Skip to content

Build and Push Docker Images #37

Build and Push Docker Images

Build and Push Docker Images #37

Workflow file for this run

name: Build and Push Docker Images
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- tag_suffix: el5
dockerfile: ./docker/Dockerfile.centos5
build_args: |
CHINA_MIRROR=0
- tag_suffix: el6
dockerfile: ./docker/Dockerfile.centos
build_args: |
VERSION_NUM=6
CHINA_MIRROR=0
- tag_suffix: el7
dockerfile: ./docker/Dockerfile.centos
build_args: |
VERSION_NUM=7
CHINA_MIRROR=0
- tag_suffix: el8
dockerfile: ./docker/Dockerfile.centos
build_args: |
VERSION_NUM=8
CHINA_MIRROR=0
- tag_suffix: el9
dockerfile: ./docker/Dockerfile.centos-stream
build_args: |
VERSION_NUM=9
CHINA_MIRROR=0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run pullsrc.sh
run: env ALL=1 ./pullsrc.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
build-args: ${{ matrix.build_args }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag_suffix }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-arm64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- tag_suffix: aarch64_el7
dockerfile: ./docker/Dockerfile.centos
build_args: |
VERSION_NUM=7
CHINA_MIRROR=0
- tag_suffix: aarch64_el8
dockerfile: ./docker/Dockerfile.centos-stream
build_args: |
VERSION_NUM=8
CHINA_MIRROR=0
- tag_suffix: aarch64_el9
dockerfile: ./docker/Dockerfile.centos-stream
build_args: |
VERSION_NUM=9
CHINA_MIRROR=0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.tag_suffix }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
file: ${{ matrix.dockerfile }}
build-args: ${{ matrix.build_args }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag_suffix }}
cache-from: type=gha
cache-to: type=gha,mode=max