feature/docker-build-arg
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 17s
unit-tests Bats test report
CI Feature / Bats tests (push) Successful in 1m12s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Successful in 1m19s
CI Feature / Report Summary (push) Successful in 4s

This commit is contained in:
moilanik
2026-06-28 13:03:40 +03:00
parent f3abd42f17
commit bea0b5cfae
4 changed files with 39 additions and 1 deletions
+14 -1
View File
@@ -8,6 +8,9 @@ on:
version:
required: true
type: string
build_args:
required: false
type: string
secrets:
GITEA_TOKEN:
required: true
@@ -44,6 +47,7 @@ jobs:
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BUILD_ARGS_INPUT: ${{ inputs.build_args }}
run: |
if [ -z "${DOCKER_REGISTRY}" ]; then echo "ERROR: DOCKER_REGISTRY not set in env.conf"; exit 1; fi
if [ -z "${DOCKER_IMAGE_NAME}" ]; then echo "ERROR: DOCKER_IMAGE_NAME not set in env.conf"; exit 1; fi
@@ -51,9 +55,18 @@ jobs:
IMAGE="${DOCKER_IMAGE_NAME}"
REGISTRY_HOST="${REGISTRY%%/*}"
BUILD_ARGS=""
if [ -n "$BUILD_ARGS_INPUT" ]; then
while IFS= read -r arg; do
[ -n "$arg" ] && BUILD_ARGS="$BUILD_ARGS --build-arg $arg"
done <<EOF
$BUILD_ARGS_INPUT
EOF
fi
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
CONTEXT_DIR=$(dirname "${DOCKERFILE}")
docker build \
docker build $BUILD_ARGS \
--label "git.commit=${{ github.sha }}" \
--label "git.commitBy=${{ github.actor }}" \
--label "build.date=${NOW}" \
+3
View File
@@ -48,6 +48,9 @@ jobs:
with:
env_json: ${{ needs.load-config.outputs.env_json }}
version: ${{ needs.check-version.outputs.version }}
build_args: |
VERSION=${{ needs.check-version.outputs.version }}
FOO=bar
docker-gitops:
name: GitOps