Add build args #1

Merged
jamie merged 9 commits from build-args into main 2025-03-03 19:39:27 +00:00
2 changed files with 20 additions and 1 deletions

View File

@ -15,6 +15,10 @@ on:
required: false
type: string
default: ${{ vars.REGISTRY_PASSWORD }}
build-args:
required: false
type: string
default: ""
jobs:
build:
@ -34,6 +38,19 @@ jobs:
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: Build
run: docker build . -t ${{ vars.REGISTRY }}/${{ gitea.repository }}:${{ inputs.tag }} -t ${{ vars.REGISTRY }}/${{ gitea.repository }}:${{ gitea.sha }}
run: |
BUILD_ARGS=""
while IFS= read -r line; do
echo "LINE CONTENT: $line"
if [ -n "$line" ]; then
BUILD_ARGS="$BUILD_ARGS --build-arg $line"
fi
done <<EOF
${{ inputs.build-args }}
EOF
echo "Final BUILD_ARGS: $BUILD_ARGS"
docker build . $BUILD_ARGS \
-t ${{ vars.REGISTRY }}/${{ gitea.repository }}:${{ inputs.tag }} \
-t ${{ vars.REGISTRY }}/${{ gitea.repository }}:${{ gitea.sha }}
- name: Push
run: docker push ${{ vars.REGISTRY }}/${{ gitea.repository }} --all-tags

View File

@ -14,6 +14,8 @@ jobs:
tag: v1.0.0
username: my-docker-username
password: ${{ secrets.DOCKER_PASSWORD }}
build-args: |
PHP_VERSION=8.4
```
### Input Parameters