Skip to content

Docker Buildx Images CI #19

Docker Buildx Images CI

Docker Buildx Images CI #19

Workflow file for this run

name: OpenIM Buildx Docker Images
on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
env:
IMAGE_NAME: openim-chat
# Common versions
GO_VERSION: "1.20"
DEFAULT_OWNER: "OpenIMSDK"
jobs:
build:
runs-on: ubuntu-latest
# strategy:
# matrix:
# bin:
# - openim-chat
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Dependencies
run: |
sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu \
libbtrfs-dev libgpgme-dev libdevmapper-dev \
qemu-user-static binfmt-support
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
# registry.cn-hangzhou.aliyuncs.com/${{github.repository_owner}}/${{env.IMAGE_NAME}}
# ghcr.io/${{github.repository_owner}}/${{env.IMAGE_NAME}}
images: |
openim/${{env.IMAGE_NAME}}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and release Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }},latest
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Log in to AliYun Docker Hub
# uses: docker/login-action@v2
# with:
# registry: registry.cn-hangzhou.aliyuncs.com
# username: ${{ secrets.ALIREGISTRY_USERNAME }}
# password: ${{ secrets.ALIREGISTRY_TOKEN }}
# - name: Build and release Docker images
# uses: docker/build-push-action@v4
# with:
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ${{ steps.meta.outputs.tags }},latest
# push: ${{ github.event_name != 'pull_request' }}