mirror of
https://github.com/mayswind/ezbookkeeping
synced 2026-04-21 13:37:43 +00:00
98 lines
2.8 KiB
YAML
98 lines
2.8 KiB
YAML
name: Build docker image for linux
|
|
|
|
inputs:
|
|
release-build:
|
|
required: false
|
|
type: string
|
|
check-3rd-api:
|
|
required: false
|
|
type: string
|
|
skip-tests:
|
|
required: false
|
|
type: string
|
|
platform:
|
|
required: true
|
|
type: string
|
|
platform-name:
|
|
required: true
|
|
type: string
|
|
docker-push:
|
|
required: true
|
|
type: boolean
|
|
docker-image-name:
|
|
required: true
|
|
type: string
|
|
docker-username:
|
|
required: false
|
|
type: string
|
|
docker-password:
|
|
required: false
|
|
type: string
|
|
docker-bake-meta-file-path:
|
|
required: true
|
|
type: string
|
|
docker-bake-meta-artifact-name:
|
|
required: true
|
|
type: string
|
|
docker-bake-digests-file-path:
|
|
required: true
|
|
type: string
|
|
docker-bake-digests-artifact-name-prefix:
|
|
required: true
|
|
type: string
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Download docker bake meta artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ${{ inputs.docker-bake-meta-artifact-name }}
|
|
path: ${{ runner.temp }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
if: ${{ inputs.docker-username != '' && inputs.docker-password != '' }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ inputs.docker-username }}
|
|
password: ${{ inputs.docker-password }}
|
|
|
|
- name: Build docker for ${{ inputs.platform-name }}
|
|
id: bake
|
|
uses: docker/bake-action@v6
|
|
with:
|
|
files: |
|
|
./docker-bake.hcl
|
|
cwd://${{ inputs.docker-bake-meta-file-path }}
|
|
source: .
|
|
load: true
|
|
targets: image
|
|
set: |
|
|
*.tags=${{ inputs.docker-image-name }}
|
|
*.platform=${{ inputs.platform }}
|
|
*.args.RELEASE_BUILD=${{ inputs.release-build }}
|
|
*.args.BUILD_PIPELINE=1
|
|
*.args.CHECK_3RD_API=${{ inputs.check-3rd-api }}
|
|
*.args.SKIP_TESTS=${{ inputs.skip-tests }}
|
|
*.output=type=image,push-by-digest=${{ inputs.docker-push }},name-canonical=true,push=${{ inputs.docker-push }}
|
|
*.output+=type=tar,dest=${{ runner.temp }}/docker-image.tar
|
|
|
|
- name: Export digests file for ${{ inputs.platform-name }}
|
|
shell: bash
|
|
run: |
|
|
digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}"
|
|
mkdir -p ${{ inputs.docker-bake-digests-file-path }}
|
|
touch "${{ inputs.docker-bake-digests-file-path }}/${digest#sha256:}"
|
|
|
|
- name: Upload ${{ inputs.platform-name }} digests artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ inputs.docker-bake-digests-artifact-name-prefix }}-${{ inputs.platform-name }}
|
|
path: ${{ inputs.docker-bake-digests-file-path }}/*
|
|
if-no-files-found: error
|