chore(CI): update build docker image
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
e5ed68665f
commit
d114bd40d8
|
@ -1,4 +1,4 @@
|
||||||
name: Release Binary
|
name: Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -9,7 +9,19 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
max-parallel: 3
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
system: [linux]
|
||||||
|
arch: [amd64, arm, arm64]
|
||||||
|
# support windows build and push?
|
||||||
|
# see the issue: https://github.com/docker/build-push-action/issues/18
|
||||||
|
# include:
|
||||||
|
# - os: windows-2022
|
||||||
|
# system: windows
|
||||||
|
# arch: amd64
|
||||||
steps:
|
steps:
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
|
@ -22,17 +34,17 @@ jobs:
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
run : |
|
run : |
|
||||||
make build_linux_amd64
|
make build_${{ matrix.system }}_${{ matrix.arch }}
|
||||||
make build_linux_arm64
|
|
||||||
make build_linux_arm
|
|
||||||
|
|
||||||
- name: Check binary
|
- name: Check binary
|
||||||
|
if: matrix.system == 'linux' && matrix.arch == 'amd64'
|
||||||
run : |
|
run : |
|
||||||
./release/linux/amd64/gorush --help
|
./release/${{ matrix.system }}/${{ matrix.arch }}/${GITHUB_REPOSITORY#*/} --help
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
@ -53,86 +65,30 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Docker meta for linux amd64
|
name: Docker meta for ${{ matrix.system }} ${{ matrix.arch }}
|
||||||
id: meta-linux-amd64
|
id: docker-meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
suffix=linux-amd64
|
suffix=${{ matrix.system }}-${{ matrix.arch }}
|
||||||
images: |
|
images: |
|
||||||
appleboy/gorush
|
${{ github.repository }}
|
||||||
ghcr.io/appleboy/gorush
|
ghcr.io/${{ github.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=,enable={{is_default_branch}}
|
type=raw,value=,enable={{is_default_branch}}
|
||||||
type=raw,value=latest,suffix=,enable={{is_default_branch}}
|
type=raw,value=latest,suffix=,enable={{is_default_branch}}
|
||||||
type=semver,event=tag,pattern={{version}},suffix=-linux-amd64
|
type=semver,event=tag,pattern={{version}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64
|
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||||
type=semver,event=tag,pattern={{major}},suffix=-linux-amd64
|
type=semver,event=tag,pattern={{major}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Build and push linux amd64
|
name: Build and push ${{ matrix.system }} ${{ matrix.arch }}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile.linux.amd64
|
file: docker/Dockerfile.${{ matrix.system }}.${{ matrix.arch }}
|
||||||
platforms: linux/amd64
|
platforms: ${{ matrix.system }}/${{ matrix.arch }}
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta-linux-amd64.outputs.tags }}
|
tags: ${{ steps.docker-meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta-linux-amd64.outputs.labels }}
|
labels: ${{ steps.docker-meta.outputs.labels }}
|
||||||
|
|
||||||
-
|
|
||||||
name: Docker meta for linux arm64
|
|
||||||
id: meta-linux-arm64
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
suffix=linux-arm64
|
|
||||||
images: |
|
|
||||||
appleboy/gorush
|
|
||||||
ghcr.io/appleboy/gorush
|
|
||||||
tags: |
|
|
||||||
type=raw,value=,enable={{is_default_branch}}
|
|
||||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm64
|
|
||||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64
|
|
||||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm64
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Build and push linux arm64
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: docker/Dockerfile.linux.arm64
|
|
||||||
platforms: linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-linux-arm64.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-linux-arm64.outputs.labels }}
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Docker meta for linux arm
|
|
||||||
id: meta-linux-arm
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
suffix=linux-arm
|
|
||||||
images: |
|
|
||||||
appleboy/gorush
|
|
||||||
ghcr.io/appleboy/gorush
|
|
||||||
tags: |
|
|
||||||
type=raw,value=,enable={{is_default_branch}}
|
|
||||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm
|
|
||||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm
|
|
||||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Build and push linux arm
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: docker/Dockerfile.linux.arm
|
|
||||||
platforms: linux/arm
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-linux-arm.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-linux-arm.outputs.labels }}
|
|
||||||
|
|
Loading…
Reference in New Issue