From 959740b3b9ec95dcd3af57d44460224734139313 Mon Sep 17 00:00:00 2001 From: TJWater CI Date: Fri, 7 Aug 2026 17:52:08 +0800 Subject: [PATCH] feat(ci): run optional Dockerfile test targets --- .gitea/workflows/container-cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitea/workflows/container-cd.yml b/.gitea/workflows/container-cd.yml index 18b6a90..4f72140 100644 --- a/.gitea/workflows/container-cd.yml +++ b/.gitea/workflows/container-cd.yml @@ -25,6 +25,11 @@ on: required: false default: "" type: string + test_target: + description: Optional Dockerfile target that performs build-time tests + required: false + default: "" + type: string deploy_service: description: Dev service to candidate-test and promote required: false @@ -73,6 +78,10 @@ jobs: if [ -n "${{ inputs.cache_image }}" ]; then cache_args+=(--cache-from "${{ inputs.cache_image }}") fi + if [ -n "${{ inputs.test_target }}" ]; then + docker build --pull=false "${cache_args[@]}" --target "${{ inputs.test_target }}" \ + -f "${{ inputs.dockerfile }}" "${{ inputs.build_context }}" + fi docker build --pull=false "${cache_args[@]}" -f "${{ inputs.dockerfile }}" \ -t "${{ inputs.image_name }}:sha-${{ gitea.sha }}" "${{ inputs.build_context }}" docker push "${{ inputs.image_name }}:sha-${{ gitea.sha }}"