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 }}"