mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-12 10:34:24 +08:00
92 lines
2.8 KiB
YAML
92 lines
2.8 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: Docker image tag
|
|
required: false
|
|
default: latest
|
|
platforms:
|
|
description: Docker platforms
|
|
required: false
|
|
default: linux/amd64,linux/arm64,linux/arm/v7
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
DOCKER_PLATFORMS: ${{ github.event_name == 'workflow_dispatch' && inputs.platforms || 'linux/amd64,linux/arm64,linux/arm/v7' }}
|
|
DOCKER_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 360
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
# Reuse dependency artifacts produced by the deb job and vice versa.
|
|
shared-key: linux-cross-release
|
|
key: ${{ hashFiles('Cross.toml', 'build/cross/Dockerfile.*') }}
|
|
cache-all-crates: true
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y unzip xz-utils
|
|
cargo install cross --version 0.2.5 --locked
|
|
|
|
- name: Build frontend
|
|
working-directory: web
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build linux binaries
|
|
run: bash build/build-images.sh
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Log in to Aliyun Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.cn-hangzhou.aliyuncs.com
|
|
username: ${{ secrets.ALIYUN_USERNAME }}
|
|
password: ${{ secrets.ALIYUN_PASSWORD }}
|
|
|
|
- name: Publish Docker images
|
|
run: |
|
|
./build/package-docker.sh --platform "$DOCKER_PLATFORMS" --registry docker.io/silentwind0 --tag "$DOCKER_TAG" --push
|
|
./build/package-docker.sh --platform "$DOCKER_PLATFORMS" --registry registry.cn-hangzhou.aliyuncs.com/silentwind --tag "$DOCKER_TAG" --push
|
|
./build/package-docker.sh --platform "$DOCKER_PLATFORMS" --registry docker.io/silentwind0 --variant full --tag "$DOCKER_TAG" --push
|
|
./build/package-docker.sh --platform "$DOCKER_PLATFORMS" --registry registry.cn-hangzhou.aliyuncs.com/silentwind --variant full --tag "$DOCKER_TAG" --push
|