WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Build and push images #39

Build and push images

Build and push images #39

name: Build and push images
on:
workflow_dispatch:
inputs:
docker_repository:
description: "Docker registry repository"
required: true
type: string
default: apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com
image_tag:
description: "Docker image tag"
required: true
type: string
default: apecloud/ape-dts:latest
platforms:
description: "Target platforms for multi-arch build"
required: true
type: string
default: linux/arm64,linux/amd64
jobs:
build:
name: Cross build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up rust
uses: dtolnay/rust-toolchain@stable
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build for x86_64
if: contains(inputs.platforms, 'linux/amd64')
run: |
cross build --target x86_64-unknown-linux-gnu --release --features metrics
cp target/x86_64-unknown-linux-gnu/release/dt-main amd64-unknown-linux-gnu-dt-main
- name: Build for aarch64
if: contains(inputs.platforms, 'linux/arm64')
run: |
cross build --target aarch64-unknown-linux-gnu --release --features metrics
cp target/aarch64-unknown-linux-gnu/release/dt-main arm64-unknown-linux-gnu-dt-main
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
- name: Build and push docker image
run: |
docker login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASSWORD }} ${{ inputs.docker_repository }}
docker buildx build -f Dockerfile.github.workflow --platform ${{ inputs.platforms }} --tag ${{ inputs.docker_repository }}/${{ inputs.image_tag }} --push .