Merge pull request 'fix: close #6 - find and build all Dockerfiles in subdirectories' (#7) from fix/issue-6 into master

Reviewed-on: https://git.example.com/jarianc/StockDocs/pulls/7
This commit is contained in:
Jarian Cottingham 2026-07-05 00:24:24 -05:00
commit ef51ef635c

View File

@ -92,13 +92,27 @@ jobs:
git clone --depth 1 $GITEA_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE git clone --depth 1 $GITEA_URL/$GITHUB_REPOSITORY $GITHUB_WORKSPACE
git -C $GITHUB_WORKSPACE checkout $GITHUB_SHA 2>/dev/null || true git -C $GITHUB_WORKSPACE checkout $GITHUB_SHA 2>/dev/null || true
- name: Build Docker image - name: Build Docker images
if: always() if: always()
run: | run: |
if [[ -f Dockerfile ]]; then DOCKERFILES=$(find . -type f \( -name "Dockerfile" -o -name "dockerfile" \) 2>/dev/null)
docker build -t $GITHUB_REPOSITORY:test . if [ -z "$DOCKERFILES" ]; then
else
echo "No Dockerfile found, skipping docker build" echo "No Dockerfile found, skipping docker build"
else
echo "Found Dockerfiles:"
echo "$DOCKERFILES"
FAIL=0
while IFS= read -r df; do
DIR=$(dirname "$df")
NAME=$(basename "$DIR")
echo "Building $DIR/dockerfile as ${NAME}:test..."
docker build -t "${NAME}:test" "$DIR/" || FAIL=1
done <<< "$DOCKERFILES"
if [ $FAIL -ne 0 ]; then
echo "One or more Docker builds failed"
exit 1
fi
echo "All Docker images built successfully"
fi fi
security: security: