54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
required: false
|
|
type: string
|
|
default: latest
|
|
username:
|
|
required: false
|
|
type: string
|
|
default: ${{ vars.REGISTRY_USERNAME }}
|
|
password:
|
|
required: false
|
|
type: string
|
|
default: ${{ vars.REGISTRY_PASSWORD }}
|
|
build-args:
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
container:
|
|
image: git.qlic.nl/qlic/build:latest
|
|
credentials:
|
|
username: ${{ inputs.username }}
|
|
password: ${{ inputs.password }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.qlic.nl
|
|
username: ${{ inputs.username }}
|
|
password: ${{ inputs.password }}
|
|
- name: Build
|
|
run: |
|
|
BUILD_ARGS=""
|
|
echo "${{ inputs.build-args }}" | while IFS= read -r line; do
|
|
if [[ ! -z "$line" ]]; then
|
|
BUILD_ARGS="$BUILD_ARGS --build-arg $line"
|
|
fi
|
|
done
|
|
echo "$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
|